Converting a date string which is before 1970 into a timestamp in MySQL.

Posted by Jamie on Stack Overflow See other posts from Stack Overflow or by Jamie
Published on 2010-05-07T12:42:28Z Indexed on 2010/05/07 13:08 UTC
Read the original article Hit count: 222

Filed under:

Not a very good title, so my apologies.

For some reason, (i wasn't the person who did it, i digress) we have a table structure where the field type for a date is varchar. (odd).

We have some dates, such as:

1932-04-01 00:00:00 and 1929-07-04 00:00:00

I need to do a query which will convert these date strings into a unix time stamp, however, in my sql if you convert a date which is before 1970 it will return 0.

Any ideas?

Thanks so much!

EDIT: Wrong date format. ooops.

© Stack Overflow or respective owner

Related posts about mysql