简体   繁体   中英

date time conversion forthis format

I have a date time column in 20210809125249 this format has to be converted to MM/DD/YYYY HH24:MI: SS how this can be done. in oracle sql

Use build in function: to_date()

You can consecutively apply TO_DATE() and then TO_CHAR() such as

 SELECT TO_CHAR( TO_DATE(theColumn,'YYYYMMDD HH24:MI:SS'),'MM/DD/YYYY HH24:MI:SS' )
   FROM theTable

in order to display as desired, presuming the first eight character represents ISO-8601-similar format( YYYY-MM-DD ) for date values

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