Php string date 将日期转换成另一种格式?
Php string date a date into another format?
您好,我想更改日期字符串 -> Sat Oct 04 00:00:00 GMT+05:30 2008
-> 为 'Y-m-d H:i:s'
格式,我的代码如下:
$lsd = strtotime($vehicle->newDate);
$newDate = date('Y-m-d H:i:s',$lsd);
我得到这样的约会 1970-01-01 05:30:00
为什么会这样?
我已经参考了:http://php.net/manual/en/function.date.php
除了 GMT+05:30
,我已经从表示标签中获取了日期
Sat Oct 04 00:00:00 GMT+05:30 2008
D M d H:i:s o
如果我得到那个标签,那么我会很感激,而不是投反对票,然后我会使用 http://php.net/manual/en/datetime.format.php,
试试这个
$lsd = strtotime($vehicle->newDate);
$newDate = date("D M j G:i:s T Y");
用这个。
$lsd = strtotime("Sat Oct 04 00:00:00 GMT+05:30 2008");
$newDate = date('Y-m-d H:i:s',$lsd);
echo $newDate;
您好,我想更改日期字符串 -> Sat Oct 04 00:00:00 GMT+05:30 2008
-> 为 'Y-m-d H:i:s'
格式,我的代码如下:
$lsd = strtotime($vehicle->newDate);
$newDate = date('Y-m-d H:i:s',$lsd);
我得到这样的约会 1970-01-01 05:30:00
为什么会这样?
我已经参考了:http://php.net/manual/en/function.date.php
除了 GMT+05:30
Sat Oct 04 00:00:00 GMT+05:30 2008
D M d H:i:s o
如果我得到那个标签,那么我会很感激,而不是投反对票,然后我会使用 http://php.net/manual/en/datetime.format.php,
试试这个
$lsd = strtotime($vehicle->newDate);
$newDate = date("D M j G:i:s T Y");
用这个。
$lsd = strtotime("Sat Oct 04 00:00:00 GMT+05:30 2008");
$newDate = date('Y-m-d H:i:s',$lsd);
echo $newDate;