thinkphp前台html格式化输出日期

输出格式:

{$time|strtotime|date="Y年m月d日",###}

格式说明:

$time 是日期字符串,一般后台的时间是"Y-m-d H:i:s"

strtotime()把字符串转化为时间整数

date(format, timestamp) 把整数时间timestamp按照format格式转换为字符串

"###"表示前面的变量(即$time)在date函数中的传入位置
举例:

<span>{$v.artdate}</span>   // 2018-11-28 10:08:55 或 2018-11-28 10:08:55.000 
<span>{$v.artdate|strtotime|date="Y-m-d H:i",###}</span> // 2018-11-28 10:08

 

posted @ 2018-11-27 11:19  风清无际  阅读(3860)  评论(0编辑  收藏  举报