フリーマーカーの日付フォーマット処理

人工知能、ゼロベースのエントリー!http://www.captainbed.net/inner 

基本パラメータ:

【1】日付:日付のみを表示し、
  などの時刻は表示しません${createTime?date}${createTime?date('yyyy-MM-dd')}

【2】時間:時刻のみを表示し、
  などの日付は表示しません${createTime?time}${createTime?time('hh:mm:ss')}

【3】日時:またはまたは
  などの時刻と日付が同時に表示されます${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