-
1
- #1
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!
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!