基本參數:
- 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
字符串類型:
日期格式:${book.date?string('yyyy-MM-dd')}
文/Devid(簡書作者)
原文鏈接:http://www.jianshu.com/p/980aaeea3402
著作權歸作者所有,轉載請聯系作者獲得授權,並標注“簡書作者”。
原文鏈接:http://www.jianshu.com/p/980aaeea3402
著作權歸作者所有,轉載請聯系作者獲得授權,並標注“簡書作者”。