MySQL Forums
Forum List  »  Connector/Node.js

Convert faulty string to date
Posted by: Kjerstin Deane
Date: November 19, 2008 11:46AM

I am a somewhat new user of mysql query browser. I'm working with a legacy database in MySql 4.1. I'm looking for some assistance in writing a select statement that would convert the text of a field to a date format. The problem is that the text of the field is not in a format that MySql seems to recognize.

The date is being stored as '11/19/8' and I would like to display it in my query resulst as '2008-11-19' so that I can use date functions on it. The field name is lastdate. I have tried breaking each component into a substring and the concatenating them. The problem that I am running into is that some months and days are 1 digit and some are 2 digits i.e. '1/1/8' vs. '11/1/8' vs. '11/11/8'. Another issue is that before Y2K the dates were '1/1/99'. Obviously the only thing common to every one of these cases is the '/'

I'm hoping someone out there has done something just like this and can offer me a quick answer.
Thanks!
-Kjerstin

Options: ReplyQuote


Subject
Written By
Posted
Convert faulty string to date
November 19, 2008 11:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.