Home > Enterprise >  date time conversion forthis format
date time conversion forthis format

Time:09-05

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

CodePudding user response:

Use build in function: to_date()

CodePudding user response:

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

  • Related