I'm stuck trying to convert a string in a Javascript format into a format I can use in PHP for filtering.
An example of the date string that I'm given is "Thu Jan 01 2015 00:00:00 GMT-0800 (Pacific Standard Time)"
Let's say I have that assigned to a variable $z. When I run the following, I get an unexpected result:
$z = "Thu Jan 01 2015 00:00:00 GMT-0800 (Pacific Standard Time)";
$value = date('Y-m-d H:i:s', strtotime($z));
This gives me $value = "1970-01-01 00:00:00", obviously not what I wanted. I've also tried the following with no luck:
$value = DateTime::createFromFormat('D M d Y H:i:s',$z); //Fails
Now I'm pretty sure that the timezone info is what is messing everything up, but I just can't seem to figure out what to do here. I'm using Laravel 5, so I've also attempted similar operations with Carbon. Does anyone have any suggestions?