if you mean how will I insert 31/12/2003 type date into a date field, you won't , you need to format it as a mysql style date to be able to use all of myslqs date functions on the field.
In this case I normally add a varchar(10) field (old_date) and a DATE field (new_date), and then convert the date from the old format to mysql format.
update my_table set new_date=date_format(concat(@year:=substring(old_date ,7,2),@month:=substring(old_date ,4,2),@day:=substring(old_date ,1,2)), '%Y-%m-%d');
*note, This is for dd/mm/yy but you can ove the elements around in the UPDATE query.
** Added this as a FAQ at long last
______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
MySql accepts date as yyyy-mm-dd. The supported range is '1000-01-01' to '9999-12-31'. if u enter wrong date or ur column is null type then u canget the value as 0000-00-00
----------------
ur feedback is a very welcome desire
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.