开发者

strotime() returning false on proper date formatted string?

开发者 https://www.devze.com 2023-01-03 17:00 出处:网络
Trying to format a date string using a technique I\'ve used countless times, s开发者_C百科uddenly returning false (PHP5). Anyone run into this?

Trying to format a date string using a technique I've used countless times, s开发者_C百科uddenly returning false (PHP5). Anyone run into this?

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


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"

Taken from http://www.php.net/manual/en/datetime.formats.date.php

strtotime should work for the date you specified. Make sure the date going into your function is really in the format m d,y

0

精彩评论

暂无评论...
验证码 换一张
取 消