简体   繁体   中英

date format conversion am to date

I need a help on how to convert '09-07-15 07:41:01AM' to '2015-07-09 07:41:01'.

I have tried below query but it is not giving accurate result.

select to_char(to_date('09-07-15 07:41:01AM'
,'DD-MM-YYYY HH:MI:SS AM')
,'YYYY-MM-DD HH24:MI:SS') from dual

Have you tried

select to_char(add_months(to_date('09-07-15 07:41:01AM','DD-MM-YY HH:MI:SS AM'),24000),'YYYY-MM-DD HH24:MI:SS') from dual

It looks like you have to many Y's, and your M's ans D's are inconsistent!

I'm not sure if it should be YY-MM-DD or YY-mm-dd ?

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