Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<?php echo "Hello?"; $thetime = strtotime("Wed Dec 16 2009 00:00:00 GMT-0500 (Eastern Standard Time)"); var_dump($thetime); ?>
此代码的计算结果为“bool(false)”;但是,仅删除“(东部标准时间)”就可以正确评估 strtotime 函数。为什么 strtotime 在字符串的时区位上阻塞的任何想法?
看起来很大卫,在这种情况下,您应该制定一个正则表达式或手动拆分您的字符串..但我认为您想使用以下代码:
<?php $new_date_str = preg_replace('\s\(.*\)','',$_POST['your_js_date']); $new_date = strtotime($new_date_str); ?>
这可能会有所帮助:)