I'm using the jquery daterangepicker, which in turn uses the jQuery datapicker.
My Ubuntu system works fine. The browser is sending a parseable string:
$dateStarted = new \DateTime($post['startDate']); // Thu Nov 15 2012 00:00:00 GMT-0700 (MST) print_r($dateStarted); Outputs:
DateTime Object ( [date] => 2012-11-15 00:00:00 [timezone_type] => 1 [timezone] => -07:00 ) On our testers Windows system, the browser is sending an expanded timezone in the string:
$dateStarted = new \DateTime($post['startDate']); // Thu Nov 15 2012 00:00:00 GMT-0700 (Mountain Standard Time) print_r($dateStarted); Throws and exception:
Exception: DateTime::__construct(): Failed to parse time string (Thu Nov 15 2012 00:00:00 GMT-0700 (Mountain Standard Time)) at position 41 (i): Double timezone specification I've googled around and can't find any resources on this specific PHP error.
I'm "solving" this problem by striping out the bracketed text which returns the same results:
$dateString = strstr($dateString, " (", true); // Thu Nov 15 2012 00:00:00 GMT-0700 This seems pretty bad to do and I'm looking for suggestions on how to do this properly.
GMT +0800 (EDT).)