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!

sys_extract_utc, sysdate and cast to timestamp

PauloSMOMay 14 2013 — edited May 15 2013
I have a question about sys_extract_utc.

According to this document:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions167.htm

SYS_EXTRACT_UTC function entry is a datetime_with_timezone.

so... running this in my system:

1) select TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI') as mysysdate from dual;
MYSYSDATE
----------------
2013-05-14 20:27


2) select TO_CHAR(systimestamp, 'YYYY-MM-DD HH24:MI TZR') as mysystimestamp from dual;
MYSYSTIMESTAMP
-------------------------------------------------
2013-05-14 20:27 +03:00


3) select TO_CHAR((cast (sysdate as timestamp)), 'YYYY-MM-DD HH24:MI TZR') as cast_sysdate_timestamp from dual;
CAST_SYSDATE_TIMESTAMP
-------------------------------------------------
2013-05-14 20:17 +00:00


4) select TO_CHAR(sys_extract_utc(cast (sysdate as timestamp)), 'YYYY-MM-DD HH24:MI TZR') as utc_time from dual;
UTC_TIME
-------------------------------------------------
2013-05-14 17:27 +00:00


Questions:
How is it possible to have the query 4) correct... if the cast of sysdate to timestamp in 3) does not have the correct timezone has you can see in query 3) !?

Where does sys_extract_utc collects the information, in order to make query 4) correct?

Edited by: PauloSMO on 14/Mai/2013 10:37
This post has been answered by Frank Kulash on May 14 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 12 2013
Added on May 14 2013
2 comments
2,044 views