Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert ISO datetime string to standard date format in Freemarker

How can I convert a string in an iso date format like

"2015-06-28T03:39:43.176Z" 

to look like

"2015-06-28 03:39:43 PDT" using Freemarker?

I tried some things like:

${x.Start?datetime(iso)?datetime}
${x.Start?datetime.iso?datetime}

But that didn't work.

like image 497
George Hernando Avatar asked Jul 02 '15 23:07

George Hernando


1 Answers

You have to use the string builting to convert the datetime variable, created from your string with the datetime.iso built-in. ${"2015-06-28T03:39:43.176Z"?datetime.iso?string("yyyy-MM-dd HH:mm:ss zzz")} works for me.

like image 181
Jozef Chocholacek Avatar answered Sep 23 '22 22:09

Jozef Chocholacek