Is it possible to print current date in specified format (Y-m-d H:i:s) in ftl (FreeMarker) ?
I want to avoid passing date from controller to view.
Is it possible to print current date in specified format ( Y-m-d H:i:s )
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Freemarker is a templating library, there isn’t a today variable, you should consider passing a
new Date()Java Object to the template, and format it. Consider to create a wrapper class for this, to generate the new Date() exactly at the time it is called.