How to convert date YYYYMMDD to YY-MM-DD in MySQL query -
i have date column in yyyymmdd or 20120101 format. because sap stores in format, cannot change this.
how can convert yyyy-mm-dd format in mysql query? in db2, used to_date() function.
in mysql, i'm trying str_to_string() function returns 'null'.
select str_to_date(vbap.erdat,'%y-%m-%d') vbap
this works..
date_format(str_to_date(vbap.erdat, '%y%m%d'),'%y-%m-%d')
Comments
Post a Comment