Freemarker日期格式化处理

人工智能,零基础入门!http://www.captainbed.net/inner 

基本参数:

【1】date: 只显示日期,不显示时间
  如${createTime?date}${createTime?date('yyyy-MM-dd')}

【2】time: 只显示时间,不显示日期
  如${createTime?time}${createTime?time('hh:mm:ss')}

【3】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')} 

猜你喜欢

转载自blog.csdn.net/qq_35860138/article/details/103833331