php strtotime is choking on time zone string
<?php
echo "Hello?";
$thetime = strtotime("Wed Dec 16 2009 00:00:00 GMT-0500 (Eastern Standard Time)");
var_dump($thetime);
?>
This code evaluates to "bool(fals开发者_开发知识库e)"; however, just removing "(Eastern Standard Time)" allows the strtotime function to evaluate correctly. Any ideas why strtotime is choking on the time zone bit of the string?
It appears so david, in this case you should either formulate a regular expression or manually split up your string.. but I think you want to use the following code:
<?php
$new_date_str = preg_replace('\s\(.*\)','',$_POST['your_js_date']);
$new_date = strtotime($new_date_str);
?>
This may help :)
精彩评论