Reputation: 2797
I'm trying to parse 2015-07-09T12:22:29
using TO_DATE
using the following date format YYYY-MM-DDTHH:MI:SS
, but I'm getting back the message as the date format is not recognized.
Upvotes: 1
Views: 137
Reputation: 93636
You have to put the T
in double quotes, like YYYY-MM-DD"T"HH:MI:SS
.
select to_date( '2015-07-09T12:22:29', 'YYYY-MM-DD"T"HH:MI:SS' ) from dual;
TO_DATE('
---------
09-JUL-15
Here's the relevant documentation. (Thanks Alex)
Upvotes: 3
Reputation: 190
Be aware that the "T" in your date string indicates that it is in UTC format, not as standard date. Just ignoring the "T" character is not going to result in a correct datetime value, as you are not accounting for your local timezone.
Check out this post for some additional information:
Convert timestamp/date time from UTC to EST Oracle SQL
Upvotes: 1