
正文
Freemarker日期格式化处理
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
基本参数:
-
date: 只显示日期,不显示时间.
如
${createTime?date}
或
${createTime?date('yyyy-MM-dd')}
-
time: 只显示时间,不显示日期
如
${createTime?time}
或
${createTime?time('hh:mm:ss')}
-
datetime: 时间和日期同时显示
如
${createTime}
或
${createTime?datetime('yyyy-MM-dd hh:mm:ss')}
或
${createTime?string('yyyy-MM-dd hh:mm:ss')}
Freemarker预置了一些日期格式
${createTime?string.short} 01:45 PM
${createTime?string.medium} 01:45:09 PM
${createTime?string.long} 01:45:09 PM PST
${createTime?string.full} 01:45:09 PM PST
${createTime?string.xs} 13:45:09-08:00
${createTime?string.iso} 13:45:09-08:00
如
${createTime?date}
或
${createTime?date('yyyy-MM-dd')}
如
${createTime?time}
或
${createTime?time('hh:mm:ss')}
如
${createTime}
或
${createTime?datetime('yyyy-MM-dd hh:mm:ss')}
或
${createTime?string('yyyy-MM-dd hh:mm:ss')}
${createTime?string.short} 01:45 PM
${createTime?string.medium} 01:45:09 PM
${createTime?string.long} 01:45:09 PM PST
${createTime?string.full} 01:45:09 PM PST
${createTime?string.xs} 13:45:09-08:00
${createTime?string.iso} 13:45:09-08:00
字符串类型:
日期格式:${book.date?string('yyyy-MM-dd')}
文/Devid(简书作者)
原文链接:http://www.jianshu.com/p/980aaeea3402
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
原文链接:http://www.jianshu.com/p/980aaeea3402
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。






