Welcome to WebmasterWorld Guest from 54.144.107.83

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)

Preferred Member

10+ Year Member

joined:Apr 28, 2003
posts:480
votes: 1


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 July 13, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 22, 2002
posts:1749
votes: 0


April has only 30 days. How does your database handle invalid dates?
10:58 pm on July 13, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 20, 2003
posts:408
votes: 0


Invalid dates are stored as 0000-00-00 in mysql.
2:45 pm on July 14, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 28, 2003
posts:480
votes: 1


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!

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members