• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

TIMESTAMPTZ

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to figure out how to get the time zone information from an
oracle.sql.TIMESTAMPTZ object. According to Oracle's Javadocs, the
getBytes() method returns an array of 13 bytes, the last two of which
specify the time zone -- but all it has to say about *how* the time
zone is represented in those two bytes is "The timezone information is
stored as an offset in the RegionID format or in the HOUR/MINUTE
format". No mention what RegionID format is.

Looking at the TIMESTAMPTZ object returned by the query "select
current_timestamp from dual", casting the ResultSet to OracleResultSet,
and calling getTIMESTAMPTZ(), I got the value 5436 (or 153C hex, with
15 being at index 11 and 3C at index 12 in the byte array). This value
does not look like it's hours/minutes, so I assume it's a RegionID.
BTW, I am in the Central European Time Zone (Netherlands/Amsterdam),
which is UTC+0100.

I don't know how to convert this RegionID value to a time zone ID as
recognized by the Java TimeZone class. And, the only way I have come up
with so far for getting any timezone information at all from
TIMESTAMPTZ is to call timestampValue(), and then use the
getTimezoneOffset() method on the java.sql.Timestamp object. There are
two things wrong with that approach: getTimezoneOffset() is a
deprecated method, and: the value it returns is just an offset in
minutes, not a timezone ID, so I wouldn't be able to distinguish
between CET and any number of African time zones, for instance.

Thanks for any insights or pointers!

- Narayan
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ginnakunta Laxmi Narayan:
I'm trying to figure out how to get the time zone information from an
oracle.sql.TIMESTAMPTZ object.



http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/9i_jdbc/NewLOBAPISample/NewLOBAPISample.java.html
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic