I want to convert javascript date Mon Jun 23 2014 16:17:05 GMT+0530 (India Standard Time)
into PHP datetime. I tried
echo date('Y-m-d h:i:s', strtotime($expire_time));
where $expire_time
is Mon Jun 23 2014 16:17:05 GMT+0530 (India Standard Time)
but it is giving 1970-01-01 12:00:00
.
Please help.
(India Standard Time)
causes the problem with parsing, so you need to remove it from the string before calling date()
. You can use something like:
$expire_time = 'Mon Jun 23 2014 16:17:05 GMT+0530 (India Standard Time)';
$expire_time = substr($expire_time, 0, strpos($expire_time, '('));
echo date('Y-m-d h:i:s', strtotime($expire_time));
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