Reputation: 1301
I have used date("mm/dd/yyyy")
format to insert get date in PHP but when i saved it in MySQL it just saved 00/00/0000
Upvotes: 0
Views: 563
Reputation: 11
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));
Upvotes: 0
Reputation: 11
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.
Upvotes: 1
Reputation: 7880
for mysql valid DATETIME
value must be like that : date("Y-m-d H:i:s");
, for DATE
must be date("Y-m-d");
Upvotes: 0
Reputation: 64399
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
Upvotes: 1
Reputation: 2264
That's not correct formatting for date: http://www.php.net/date
date("m/d/Y");
is what you're looking for.
Upvotes: 1