Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Can't insert dates

Dates are being entered as 0000-00-00



10:43 pm on Jul 13, 2006 (gmt 0)

10+ Year Member

I'm trying to import some data into my database. The table I'm trying to import the data into has a date column in the first field. Even when I click the 'Insert' button in phpmyadmin, type in '2006-04-31' in the date field, and press 'Go' to insert the enw row the date is still entered as 0000-00-00.

I have about 3000 rows of data and even doing an update query after the import doesnt work. For example, "update table set date='2006-04-31' WHERE date='0000-00-00'" affects 0 rows even though the date for all of them is 0000-00-00 and I can delete them using this query "delete FROM `google_data` WHERE date='0000-00-00'".

Any idea whats going on? The field type is 'date', null is set to 'no', and Default is set to '0000-00-00'.


10:52 pm on Jul 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

April has only 30 days. How does your database handle invalid dates?


10:58 pm on Jul 13, 2006 (gmt 0)

10+ Year Member

Invalid dates are stored as 0000-00-00 in mysql.


2:45 pm on Jul 14, 2006 (gmt 0)

10+ Year Member

Wow, of all the technical work-arounds I tried for over an hour to do a simple import that worked fine on other files it never even occurred to me the date was wrong lol.

Lesson learned. Thanks so much!


Featured Threads

Hot Threads This Week

Hot Threads This Month