I have a START_DATE column in my table with values in the format YYYY-MM-DD HH:MM:SS AM/PM GMT
. I'm trying to insert those values into another table but i'm getting a date format not recognized
error. How do I fix this?
Sample SQL statement
INSERT INTO TABLE2 (
DATE_WITH_TIMEZONE,
DATE_WITHOUT_TIMEZONE
)
SELECT
TO_TIMESTAMP(START_DATE, 'YYYY-MM-DD HH:MI:SS AM TZD'),
TO_DATE(TO_TIMESTAMP(START_DATE, 'YYYY-MM-DD HH:MI:SS AM TZD'), 'YYYY-MM-DD HH:MI:SS AM')
FROM TABLE_DATE
Sample Data
2016-01-21 09:31:49 AM GMT
2016-02-22 06:37:32 PM GMT
2016-02-23 07:10:52 PM GMT
2016-03-15 08:54:40 PM GMT
2016-03-16 12:10:52 AM GMT
If it helps, these are the datatypes of the two columns in TABLE2
DATE_WITH_TIMEZONE TIMESTAMP WITH TIME ZONE
DATE_WITHOUT_TIMEZONE DATE