官方文檔: http://freemarker.incubator.apache.org/docs/ref_builtins_date.html
默認(rèn)按照本地計(jì)算機(jī)地區(qū)進(jìn)行日期格式化掠河。
基本參數(shù):
- date: 只顯示日期亮元,不顯示時(shí)間.
如${createTime?date}
或${createTime?date('yyyy-MM-dd')}
- time: 只顯示時(shí)間,不顯示日期
如${createTime?time}
或${createTime?time('hh:mm:ss')}
- datetime: 時(shí)間和日期同時(shí)顯示
如${createTime}
或${createTime?datetime('yyyy-MM-dd hh:mm:ss')}
或${createTime?string('yyyy-MM-dd hh:mm:ss')}
Freemarker預(yù)置了一些日期格式
${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