Converting a timestamp field from GMT to EST
KVBJun 6 2013 — edited Jun 7 2013Hi
I have to convert the timestamp field coming from the source from GMT to EST.
CREATE TABLE X
(
TS_FIELD TIMESTAMP(6)
);
INSERT INTO X VALUES('07-JAN-13 02.00.06.597000 PM');
INSERT INTO X VALUES('07-FEB-13 02.00.06.676000 PM');
INSERT INTO X VALUES('07-MAR-13 12.36.14.260000 PM');
INSERT INTO X VALUES('07-APR-13 12.36.56.713000 PM');
INSERT INTO X VALUES('07-MAY-13 03.46.48.800000 AM');
I need to convert the above timestamp field from GMT to EST in 24hour format.
I tried it doing,but I am getting hours conflict with the day error.
I have tried the below one and milliseconds being set to zero's
select X,
TO_timestamp(TO_CHAR(CAST(FROM_TZ(CAST(TO_DATE(TO_CHAR(X,'YYYY-MM-DD HH24:MI:SS.SSSSS')
,'YYYY-MM-DD HH24:MI:SS.SSSSS')
AS TIMESTAMP),'GMT') AT TIME ZONE 'US/EASTERN' AS DATE),'YYYY-MM-DD HH24:MI:SS.SSSSS'),'YYYY-MM-DD HH24:MI:SS.SSSSS')
FROM X
Please help me in this regard.I am trying in parallel as well.
Thanks in advance
KVB