【发布时间】:2016-05-21 19:42:59
【问题描述】:
我正在使用 Laravel 4,我想显示 created_at。它是时间戳。
我这样显示-应该是这种格式-Y.m.d / h:i
但它显示错误的结果。数据库中的 created_at 列有值 -
2016-05-18 00:00:00
但是当我以这种方式显示它时,它会显示:
2016.05.18 / 12:00
@if($data->created_at !== '0000-00-00 00:00:00')
{{date('Y.m.d / h:i', strtotime($data->created_at)) }}
@endif
【问题讨论】:
-
Y.m.d / h:i应该是Y.m.d / H:i大写H24 小时时间。你也可以从使用 Laravel 内置的 Date mutators 中受益。