我正在尝试转换一些日期
<p>{{ Carbon\Carbon::parse($post->created_at)->diffForHumans() }}</p>
这段代码的日期格式为2017-05-01 10:52:51,因此能够正常工作。
但是,我也有一些日期以 Unix 时间戳的形式存储。
如何将它们转换成日期格式呢?
我已经尝试过:
{{ Carbon\Carbon::createFromTimestamp($post->created_at)->toDateTimeString() }}
错误 - 非格式良好的数字值遇到
转储是
<pre class="xdebug-var-dump" dir="ltr">
<small>int</small>
<font color="#4e9a06">1493637826</font>
</pre>
$post->created_at
值的示例数据吗?(var_export
) - scrowler{{ }}
。 - scrowler