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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change (UPDATE) table date field.

Status
Not open for further replies.

KarveR

MIS
Dec 14, 1999
2,065
GB
Hi, I'm trying to update a field from a (poorly) formatted date to a more appropriate date.
+--------+ +----------+
|mov_date| |mov_date |
+--------+ +----------+
|17/11/01| |2001-11-17|
+--------+ +----------+
I have .....I want.
date on the left is DDMMYY, I need to change 5700+ records, all dates are different. whats the easiest way to do the lot?

Thanks in advance :) ***************************************
Party on, dudes!
 
nm i got it in the end ..

mysql> 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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top