【发布时间】:2015-03-07 13:36:44
【问题描述】:
从 json 中,我得到的值是
"createdOn": "Jan 08 2015 20:40:56 GMT+0530 (IST)",
我在 FTL 中访问
<#list variables as variable>
<div class="reply">
${variable.createdOn}
</div>
</#list>
我得到的结果是
Jan 09 2015 12:36:18 GMT+0530 (IST)
我更喜欢的格式是
09-01-2015
我需要删除其余时间 GMT、IST 等。
如何在 Freemarker 模板或 javascript 中转换。
更新
我试着像这样通过下面
${variable.createdOn?datetime?string("dd-MM-yyyy")}
但它给出了错误
Exception: java.text.ParseException - Unparseable date: "Jan 09 2015 12:36:18 GMT+0530 (IST)"
感谢任何帮助。
谢谢
【问题讨论】:
标签: javascript date freemarker