Incorrect datetime value??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stylus
Forum Newbie
Posts: 17
Joined: Fri Dec 16, 2005 9:22 am

Incorrect datetime value??

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

MySQL datetime format is: Y-m-d H:i:s
Post Reply