Forums de discussion

Fetching the java.util.Date for current date through velocity

camille vienot, modifié il y a 15 années.

Fetching the java.util.Date for current date through velocity

New Member Publications: 15 Date d'inscription: 10/10/08 Publications récentes
Hello,
I am trying to diplay through an article the following event coming up in my Calendar porler. In the template file, I can access all the CalEvents through the findServiceLocator velocity variable, including the java.util.Date, through the getStartDate() method. However, to choose which one to display, I need the current date. If I can fetch it in a String format through $dateUtil.getCurrentDate("yyyyMMdd", $locale), I cannot get it at a java.util.Date format. I tried $dateUtil.getCurrentDate(), as in the init.vm file used for themes, but it does not work.
Any idea of how I could do
Thanks
Camille
thumbnail
Wilson Man, modifié il y a 15 années.

RE: Fetching the java.util.Date for current date through velocity

Liferay Master Publications: 581 Date d'inscription: 21/06/06 Publications récentes
instead of
$dateUtil
, try
$dateTool.getDate()
... or
$dateTool.getSystemDate()
camille vienot, modifié il y a 15 années.

RE: Fetching the java.util.Date for current date through velocity

New Member Publications: 15 Date d'inscription: 10/10/08 Publications récentes
Thank you very much it works!
Vaibhav Mittal, modifié il y a 11 années.

RE: Fetching the java.util.Date for current date through velocity

Junior Member Publications: 54 Date d'inscription: 16/07/12 Publications récentes
Thnxx Wilson it worked for me also emoticon
minakshi verma, modifié il y a 5 années.

RE: Fetching the java.util.Date for current date through velocity

New Member Envoyer: 1 Date d'inscription: 08/03/19 Publications récentes
i also tried with this solution in velocity templates
$dateTool.getSystemDate()

But it is printing same on template should i added something somewhere ?