留言板

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

camille vienot,修改在15 年前。

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

New Member 帖子: 15 加入日期: 08-10-10 最近的帖子
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,修改在15 年前。

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

Liferay Master 帖子: 581 加入日期: 06-6-21 最近的帖子
instead of
$dateUtil
, try
$dateTool.getDate()
... or
$dateTool.getSystemDate()
camille vienot,修改在15 年前。

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

New Member 帖子: 15 加入日期: 08-10-10 最近的帖子
Thank you very much it works!
Vaibhav Mittal,修改在11 年前。

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

Junior Member 帖子: 54 加入日期: 12-7-16 最近的帖子
Thnxx Wilson it worked for me also emoticon
minakshi verma,修改在5 年前。

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

New Member 发布: 1 加入日期: 19-3-8 最近的帖子
i also tried with this solution in velocity templates
$dateTool.getSystemDate()

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