PHP Date Problem
I have used date("mm/dd/yyyy")
for开发者_如何学Pythonmat to insert get date in PHP but when i saved it in MySQL it just saved 00/00/0000
That's not correct formatting for date: http://www.php.net/date
date("m/d/Y");
is what you're looking for.
Your date format is wrong. Try date('m/d/Y');
date("mm/dd/yyyy")
doesn't do what you think it does. Check out the manual and you can find you probably meant
date("m/d/Y"); // 03.10.2011
date("mm/dd/yyyy") this format is not supported by the mysql.as mysql supports the date format in yyyy/mm/dd. so try to enter in this format.The 0 error would be removed.
for mysql valid DATETIME
value must be like that : date("Y-m-d H:i:s");
, for DATE
must be date("Y-m-d");
Enter the date in the normal format dd-mm-yyyy bt when u extract the date value from the databse sql thn use the function: $date=date("Y-m-d",strtotime($date1));
精彩评论