[英]How to convert PDT time format to this format `2016-09-13 08:56:55 +0000` - using PHP?
This string 2016-09-13 08:56:55 +0000
- What is the time zone? 这个字符串2016-09-13 08:56:55 +0000
- 什么是时区?
How do convert PDT time format Wed Oct 12 14:40:50 PDT 2016
to this foramt 2016-09-13 08:56:55 +0000
. 如何将PDT时间格式转换为Wed Oct 12 14:40:50 PDT 2016
2016-09-13 08:56:55 +0000
。
I am try: 我试试:
$input_datetime = 'Wed Oct 12 14:40:50 PDT 2016';
$result_datetime = date('Y-m-d H:i:s',strtotime($input_datetime)) . ' +0000';
echo $result_datetime; // 2016-10-12 14:40:50 +0000
I don't know about timezones
. 我不知道timezones
。 Just I'm making the datetime
format. 我正在制作datetime
格式。 Please update the solutions or suggest. 请更新解决方案或建议。 Thanks for every one! 谢谢你们!
Your expected output does not make sense to me, because line nogad mentioned, the seconds and minutes change. 你的预期输出对我来说没有意义,因为线路nogad提到,秒和分钟的变化。 Please clarify. 请澄清。 Meanwhile here the conversion format you wanted: 同时在这里你想要的转换格式:
$datestr = 'Wed Oct 12 14:40:50 PDT 2016';
$dt = new DateTime($datestr);
echo $dt->format("Y-m-d\ H:i:s O");
Output is: 输出是:
2016-10-12 14:40:50 -0700
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.