String To Date Conversion in Mysql -


i have column values 20150921. want convert string value specified date format 2015-09-21 in mysql.

try this:

date_format(str_to_date('20150921', '%y%m%d'),'%y-%m-%d') 

sql fiddle demo

(assuming want date format in yyyy-mm-dd format)


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -