Reputation: 5540
Below is the two lines of code that throws error:
<#assign test2="20:56:20"?time("HH:mm:ss")>
${test2?date}
The second line ends up with error:
freemarker.template.TemplateException: Cannot convert TIME into DATE
I know this is expected. But how can I check, if a date variable has got the 'date' value before displaying it on screen? For ex: In above example, i would like to check if 'test2
' contains a date
part before diplaying it on screen.
Upvotes: 3
Views: 3811
Reputation: 26860
This is how i usually do it:
dateIssued?datetime("MM/dd/yyyy hh:mm a")
or
dateIssued?datetime("hh:mm a")
or
dateIssued?datetime("MM/dd/yyyy")
Just make sure you passing into your model java.util.Date
So I just use the datetime all the time. Hope this will help you.
Upvotes: 2