Php时间戳格式设置不起作用
我正在尝试将时间戳2017年9月2日周六06:00:00 GMT+0600中亚标准时间格式化为Y-m-d格式。但这不起作用,我得到的是1970-01-01作为输出 我的代码:Php时间戳格式设置不起作用,php,Php,我正在尝试将时间戳2017年9月2日周六06:00:00 GMT+0600中亚标准时间格式化为Y-m-d格式。但这不起作用,我得到的是1970-01-01作为输出 我的代码: $date="Sat Sep 02 2017 06:00:00 GMT+0600 (Central Asia Standard Time)"; $date_exist=date('Y-m-d',strtotime($date)); echo $date_exist; 如果要制作UNIX时间戳,请将与
$date="Sat Sep 02 2017 06:00:00 GMT+0600 (Central Asia Standard Time)";
$date_exist=date('Y-m-d',strtotime($date));
echo $date_exist;
如果要制作UNIX时间戳,请将与mktime一起使用
$date="Sat Sep 02 2017 06:00:00 GMT+0600 (Central Asia Standard Time)";
$date_array= date_parse ($date);
echo mktime($date_array['hour'],$date_array['minute'],$date_array['second'],$date_array['day'],$date_array['month'],$date_array['year']);
以下是输出:
1486616400
使用此代码
<?php
$date="Sat Sep 02 2017 06:00:00 GMT+0600 (Central Asia Standard Time)";
$dt = date_parse ($date);
$dt_ = $dt['year'].'-'.$dt['month'].'-'.$dt['day'];
echo $date_exist=date('Y-m-d',strtotime($dt_)); ?>
这将以这种方式为我的案件如何格式?使用日期解析简单的完美答案!你们能告诉我为什么我的代码在本地服务器上工作吗?让我给你们一个这个代码的演示链接。