Php 将时间戳转换为自定义格式Laravel
如何将时间戳转换为以下格式Php 将时间戳转换为自定义格式Laravel,php,timestamp,laravel-5.1,Php,Timestamp,Laravel 5.1,如何将时间戳转换为以下格式2015年12月3日 DB时间戳2015-12-03 05:23:08 这就是我试过的 <td>{{ date('d/m/Y', strtotime($user->created_at)) }}</td> {{date('d/m/Y',strottime($user->created_at))} 但我不知道如何用三个字来表达这个月。请告知您可以这样做: <td>{{ strftime("%d %b %Y",strtot
2015年12月3日
DB时间戳2015-12-03 05:23:08
这就是我试过的
<td>{{ date('d/m/Y', strtotime($user->created_at)) }}</td>
{{date('d/m/Y',strottime($user->created_at))}
但我不知道如何用三个字来表达这个月。请告知您可以这样做:
<td>{{ strftime("%d %b %Y",strtotime($user->created_at)) }}</td>
{{strftime(%d%b%Y),strotime($user->created_at))}
或者
{{date(“dmy”,strottime($user->created_at))}
您可以执行以下操作:
<td>{{ strftime("%d %b %Y",strtotime($user->created_at)) }}</td>
{{strftime(%d%b%Y),strotime($user->created_at))}
或者
{{date(“dmy”,strottime($user->created_at))}
创建的\u应该是碳的实例。然后你可以做:
{{ $user->created_at->format('d M Y') }}
创建时应该是碳的一个实例。然后你可以做:
{{ $user->created_at->format('d M Y') }}
这是一个普通的php,
created\u在
是一个Carbon
对象,如果您在类中使用protected$dates
数组。即使您不这样做,它通常默认为Carbon
date对象。你可以调用->format('d/m/Y')
,就像@Zoe Blair在她的回答中写道的那样。这是一个普通的php,created_在
是一个Carbon
对象,如果你在你的类中使用protected$dates
数组。即使您不这样做,它通常默认为Carbon
date对象。你可以直接调用->format('d/m/Y')
,就像@zoeblair在她的回答中写道的那样。