Page 1 of 1

Incorrect datetime value??

Posted: Mon Dec 19, 2005 11:23 am
by stylus
Hello,

I am attempting to insert in to a datetime column in a MySql database, it seems like I had this working and now its not, but I took a few weeks off of this project so maybe I forgot what happened.

this is how I am creating the date:

Code: Select all

$requested_date = date('m-d-y H:i:s');
Have tired my date formatting without the dashs and colons and space, didnt help.


this is the input box on my form:

Code: Select all

<input type="hidden" name="requested_date" value="<?php echo "$requested_date"; ?>">
this is the error message when I do the insert in to my DB:

Incorrect datetime value: '12-19-05 12:24:13' for column 'requested_date' at row 1

What is the proper format for a date in a MySql DateTime field?? I thought I had it

Posted: Mon Dec 19, 2005 11:33 am
by feyd
MySQL datetime format is: Y-m-d H:i:s