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!

incorrect time when using to_timestamp_tz

ZiyavurAug 6 2017 — edited Aug 7 2017

Hi ,

I am using below query to convert time from 'Etc/GMT-7' timezone to GMT time zone.I am expecting date time to be 10-AUG-2017 05:35:00 AM(7hrs ahead) but getting

09-AUG-17 10:35:00 AM. Please advise where I am doing wrong.

SELECT

TO_DATE(TO_CHAR(to_timestamp_tz(to_char(to_date('09-AUG-2017 17:35:00','DD-MON-YYYY HH24:MI:SS'),'DD-MON-YYYY HH24:MI:SS') || ' ' || 'Etc/GMT-7' , 'DD-MON-YYYY HH24:MI:SS TZR') AT TIME ZONE 'GMT','DD-MON-YYYY HH24:MI:SS'),'DD-MON-YYYY HH24:MI:SS') SCH_DEP_GMT

FROM DUAL;

OUTPUT

09-AUG-17 10:35:00 AM

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2017
Added on Aug 6 2017
8 comments
451 views