Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将时间戳转换为自定义格式Laravel_Php_Timestamp_Laravel 5.1 - Fatal编程技术网

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在她的回答中写道的那样。