Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL reformat existing Dates 1

Status
Not open for further replies.

KarveR

MIS
Dec 14, 1999
2,065
GB
Took mne hours to figure this out, may be useful to some.

Background:
I had a whole date column populated with dates formatted like dd/mm/yy and needed it to repopulate itself in the correct yyyy-mm-dd format using the original date.

this is flexible in that you can move the conact(Y M D) elemenst around as required.

----------------->
update my_table set my_date=date_format(concat(@year:=substring(mov_date ,7,2),@month:=substring(mov_date ,4,2),@day:=substring(mov_date ,1,2)), '%Y-%m-%d'); ***************************************
Party on, dudes!
[cannon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top