Home  >  Article  >  Backend Development  >  thinkPHP的模版格式化时间的问题

thinkPHP的模版格式化时间的问题

WBOY
WBOYOriginal
2016-06-23 13:48:491341browse

我在模版上格式化时间

<eq name="vo.rectype" value="1">{$vo['recstart']|date="Y-m-d H:i:s",###}</eq><eq name="vo.rectype" value="2">{$vo['recstart']|date="Y-m-d",###}</eq>

怎么输出的是
 1970-01-01 

这是为什么啊? 急求。。。。


回复讨论(解决方案)

来个人,接分啊~~~

date()函数是那么用的?不是date("Y-m-d H:i:s")这样?

{$vo['recstart']}
输出的是什么?

应该是$vo['recstart']的值为null或者为0了,导致输出的时间为1970-01-01。
你再检查下你后台的赋值。

这个是格式化UNIX时间戳的。不是截取时间的。我也碰到这个问题。你可以直接截取字符串{$vo.title|substr=0,5}

没取到时间,dump一下看看

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn