PLSQL Convert String to Datetime

4.5k views Asked by At

The 'closed_date' column and 'submit_date' are loaded into Oracle as strings, they look like this:

8/17/2017 12:41 (in 24hrs)

How can I convert this string format into date in the format of mm/dd/yyyy hh24:mi:ss

Thank you!

2

There are 2 answers

0
Gordon Linoff On BEST ANSWER

Given your date format, you don't want seconds:

select to_date(CLOSED_DATE, 'mm/dd/yyyy hh24:mi') as CLOSED_DATE,
       to_date(SUBMIT_DATE, 'mm/dd/yyyy hh24:mi') as SUBMIT_DATE
from s_daily_ops
0
J_H On

Tack on a trailing ':00', or remove ':ss' from your format string.