2010-06-17 105 views
1

尝试使用我无数次使用的技术来格式化日期字符串,突然返回false(PHP5)。任何人遇到这个?strotime()返回false在正确的日期格式化字符串?

//$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

无法复制。什么操作系统和区域设置? – 2010-06-17 20:26:42

+1

无法复制。 *精确*您使用的是哪个PHP版本?你确定*最初的'$ new_date'有那个值吗? – salathe 2010-06-17 20:30:58

+0

复制关于无法复制的先前评论。取消注释代码中的第一行。 – webbiedave 2010-06-17 20:34:42

回答

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