strtotime()在正确的日期格式化字符串返回false?

时间:2010-06-17 20:23:49

标签: php

尝试使用我无数次使用的技术格式化日期字符串,突然返回false(PHP5)。有人碰到这个吗?

//$new_date = June 14,2010
echo $new_date;
$new_date = date("F j, Y", strtotime($new_date));
//returns the infamous December 31, 1969 because strototime() is returning false?

1 个答案:

答案 0 :(得分:0)

Type of string               |           REGEX                  |   EXAMPLE
Textual month, day and year  | m ([ .\t-])* dd [,.stndrh\t ]+ y | "July 1st, 2008", "April 17, 1790", "May.9,78"

取自http://www.php.net/manual/en/datetime.formats.date.php

strtotime应该适用于您指定的日期。确保进入函数的日期格式为m d,y