简体   繁体   中英

Convert to date format from integer

I have date in integer format 140529(yymmdd). I want this date to be date format to be as 2014-05-29.

How can i do this . Please Help

Try:

SELECT CONCAT('20', SUBSTR ( 150817 , 0, 2 ), '-', SUBSTR ( 150817 , 3, 2 ), '-', SUBSTR ( 150817 , 5, 2 )) AS DATE;

And replace the "integer date" 150817 with your date

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM