This string 2016-09-13 08:56:55 +0000 - What is the time zone?
How do convert PDT time format Wed Oct 12 14:40:50 PDT 2016 to this foramt 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. Just I'm making the datetime format.
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. 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With