Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

need to change time from 12 hour to 24 hr format

ateeqrahmanAug 8 2021

Hi,
I have a date column (LIM_INVOICE_DATE) which stores data in this format "8/1/2021 9:04:31 AM".
I am creating a view in which i need to store date and time in seperate columns. I tried to convert the time as follows but got error "ORA-01858: a non-numeric character was found where a numeric was expected". Please help
select TO_CHAR(To_date(LIM_INVOICE_DATE,'HH:MI:SS AM'),'HH24:MI:SS') from LESSEE_INVOICE_MASTER;

However when i run dummy value from dual it gives correct result.
Select TO_CHAR(To_date('10:35:24 PM','HH:MI:SS AM'),'YYYY-MM-DD HH24:MI:SS') From DUAL;

This post has been answered by Frank Kulash on Aug 8 2021
Jump to Answer
Comments
Post Details
Added on Aug 8 2021
4 comments
25,332 views