Foren

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

camille vienot, geändert vor 15 Jahren.

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

New Member Beiträge: 15 Beitrittsdatum: 10.10.08 Neueste Beiträge
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, geändert vor 15 Jahren.

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

Liferay Master Beiträge: 581 Beitrittsdatum: 21.06.06 Neueste Beiträge
instead of
$dateUtil
, try
$dateTool.getDate()
... or
$dateTool.getSystemDate()
camille vienot, geändert vor 15 Jahren.

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

New Member Beiträge: 15 Beitrittsdatum: 10.10.08 Neueste Beiträge
Thank you very much it works!
Vaibhav Mittal, geändert vor 11 Jahren.

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

Junior Member Beiträge: 54 Beitrittsdatum: 16.07.12 Neueste Beiträge
Thnxx Wilson it worked for me also emoticon
minakshi verma, geändert vor 5 Jahren.

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

New Member Beitrag: 1 Beitrittsdatum: 08.03.19 Neueste Beiträge
i also tried with this solution in velocity templates
$dateTool.getSystemDate()

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