I am trying to print the current date when the template is activated. I have read that I have to pass a new Date() Java object to the template, but I don\'t know how to do that
${.now}
is the perfect answer. Just wanted to add few other ways to get direct values from date
#-- Predefined format names: -->
${openingTime?string.short}
${openingTime?string.medium}
${openingTime?string.long}
${openingTime?string.full}
${openingTime?string.xs} <#-- XSD xs:time -->
${openingTime?string.iso} <#-- ISO 8601 time -->
${.now?string.short}
${.now?string.medium}
${.now?string.long}
${.now?string.full}
${.now?string.xs} <#-- XSD xs:date -->
${.now?string.iso} <#-- ISO 8601 date -->
${.now?string.short}
${.now?string.medium}
${.now?string.long}
${.now?string.full}
${.now?string.medium_short} <#-- medium date, short time -->
${.now?string.xs} <#-- XSD xs:dateTime -->
${.now?string.iso} <#-- ISO 8601 combined date and time -->
<#-- Programmer-defined named format (@ + name): -->
${.now?string.@fileDate}
<#-- Advanced ISO 8601 and XSD formatting: -->
${.now?string.iso_m_u}
${.now?string.xs_ms_nz}
<#-- SimpleDateFormat patterns: -->
${.now?string["dd.MM.yyyy, HH:mm"]}
${.now?string["EEEE, MMMM dd, yyyy, hh:mm a '('zzz')'"]}
${.now?string["EEE, MMM d, ''yy"]}
${.now?string.yyyy} <#-- Same as ${.now?string["yyyy"]} -->
will output
01:45 PM
01:45:09 PM
01:45:09 PM PST
01:45:09 PM PST
13:45:09-08:00
13:45:09-08:00
2/20/07
Apr 20, 2007
April 20, 2007
Friday, April 20, 2007
2007-02-20-08:00
2007-02-20
2/20/07 01:45 PM
Feb 20, 2007 01:45:09 PM
February 20, 2007 01:45:09 PM PST
Friday, February 20, 2007 01:45:09 PM PST
Feb 8, 2003 9:24 PM
2007-02-20T13:45:09-08:00
2007-02-20T13:45:09-08:00
Apr/20/2007 13:45
2007-02-20T21:45Z
2007-02-20T13:45:09.000
08.04.2003 21:24
Tuesday, April 08, 2003, 09:24 PM (PDT)
Tue, Apr 8, '03
2003