views:

276

answers:

1
<?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(false)"; 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?

A: 

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 :)

Jay