Forum Discussion

rohitpar88's avatar
11 years ago

How to change the date format using Freemarker

Hello,

 

I  have created one custom component as user registered time and I have called the REst API for the same. but now i want to change the format of the date using freemarker. 

 

Here is my code

<#assign rohit1 = restadmin("users/id/35/registration_time")>
${rohit1.value?string("yyyy-MM-dd HH:mm:ss zzzz")}

 

But I am facing an error.

Can you please help to advise how to change the format of the date in Freemarker" I want this format 03 September 2014"

 

Thanks

 

2 Replies

  • Hi rohitpar88  - use the following snippet.

     

    <#assign rohit1 = restadmin("/users/id/35/registration_time").value >
    <#assign postTimeObject = rohit1?datetime("yyyy-MM-dd'T'hh:mm:ss") />
    ${postTimeObject?string("dd MMMM yyyy")}