sql - Convert yyyy/mm/dd into dd/mm/yyyy hh24:MI:SS -
i'm trying convert data in format 2016/06/26
26/06/2016 00:00:00
trying few option time getting error "invalid months name", idea/advice? thanks
select to_date('2016/05/07 00:00:00','mm/dd/yyyy hh24:mi:ss') dual
in order convert string date need convert first date. problems trying format string not date. specific case be:
--convert first date select to_date('2016/05/07 00:00:00','yyyy/mm/dd hh24:mi:ss') dual --then convert string in format want: select to_char( to_date('2016/05/07 00:00:00','yyyy/mm/dd hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss' ) dual --since want date: --then convert string in format want: select to_date( to_char( to_date('2016/05/07 00:00:00', 'yyyy/mm/dd hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss' ) 'mm/dd/yyyy hh24:mi:ss' ) dual
if want convert string date no matter format, use first select showed. @boneist in comments pointing out.
Comments
Post a Comment