Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

CSV into MySQL for Dates - formatting



11:38 pm on Dec 4, 2011 (gmt 0)

Had a quick question,

I have a very large CSV file with dates formatted like 4/29/2005 and would like to insert these values into my MySQL database.

It currently truncates my value and eliminates it by replacing it with 0000-00-00 (currently using the Date format). Is there a way for me to modify either the CSV or DB to correctly transfer the date correctly?


11:57 pm on Dec 4, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

You'll need YYYY-MM-DD format.

If your text editor has RegEx edit capability then you could easily reformat the data.

Replace * with whatever is immediately before and after the date: comma, quote, space, whatever.

First pass:
* =>

Second pass:

[edited by: g1smd at 12:03 am (utc) on Dec 5, 2011]


11:59 pm on Dec 4, 2011 (gmt 0)

Oh okay,

I will try to figure that out then, thanks :)


9:00 am on Dec 13, 2011 (gmt 0)

Now that is pretty awesome :)

Took me a couple min to figure out how to get the reg-ex working in the actual editor, but that is really neat...didn't even know it was possible. lol - a huge time saver!

Thanks for coming back and adding those couple lines, they helped a ton!

Featured Threads

Hot Threads This Week

Hot Threads This Month