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!

Converting a timestamp field from GMT to EST

KVBJun 6 2013 — edited Jun 7 2013
Hi

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
This post has been answered by Chris Hunt on Jun 6 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2013
Added on Jun 6 2013
9 comments
4,277 views