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!

UTC Conversion

vpolasaApr 29 2016 — edited Apr 30 2016

I'm trying to convert India tz to UTC tz. I'm bit skeptical with the output. Can someone please help me with the query if I'm doing something wrong?

SELECT TO_CHAR(CAST(SYS_EXTRACT_UTC(FROM_TZ(TO_TIMESTAMP(TO_DATE('30-SEP-1941 23:00:00', 'DD-MON-YYYY HH24:MI:SS')), 'Asia/Calcutta')) AS DATE), 'DD-MON-YYYY HH24:MI:SS' ) FROM DUAL;


30-SEP-1941 17:07:00


I think the offset is 5:30, but the output shows 17:07.

But when I try as below, I'm seeing expected output:

SELECT TO_CHAR(CAST(SYS_EXTRACT_UTC(FROM_TZ(TO_TIMESTAMP(TO_DATE('01-OCT-1941 01:00:00', 'DD-MON-YYYY HH24:MI:SS')), 'Asia/Calcutta')) AS DATE), 'DD-MON-YYYY HH24:MI:SS' ) FROM DUAL;

30-SEP-1941 18:30:00

Using Windows 7

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

This post has been answered by mathguy on Apr 30 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2016
Added on Apr 29 2016
11 comments
2,288 views