MySQL datetime insert
February 5, 2009 2:20 PM Subscribe
Inserting a date into MySQL? Is there a to_date() equivalent to convert a string to a datetime?
posted by exhilaration to computers & internet (4 answers total)
I can do this in Oracle:
insert into table_name
(to_date('05/03/2003 21:02:44', 'mm/dd/yyyy hh24:mi:ss'));
Is there a similar to_date() function in MySQL that will let me format a string? Everything I'm finding on the web says that the only way to do it is if your string is already
in 'YYYY-MM-DD HH:MM:SS' format (that's from the manual
I have a few hundred records in a text file that I need load into a table, so I can't use tricks like now() and I really don't want to have to fix a all those dates. Ideas? Suggestions?