我正在使用 Carbon API 来格式化日期,这是我在视图中编写的代码:
<td>{{ Carbon\Carbon::parse('@'.$item->time)->format('d-m-Y H-i-s-e') }}</td>
我查看的日期与存储在 MongoDB 中的数据不匹配,在 MongoDB 中日期是ISODate("2018-03-31T01:08:50.000+0000")
但我得到"16-10-50214 19-13-20-+00:00"
.
经过大量搜索,如果您使用的是 mongodb,我找到了在刀片中查看日期的最佳解决方案:
{{ $item['time']->toDateTime()->format('d-m-Y H:i:s e') }}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句