Re: [cx-oracle-users] Getting timezone info out of systimestamp
Brought to you by:
atuining
From: <wa...@li...> - 2006-05-09 20:25:33
|
Anthony Tuininga wrote: > I am currently ignoring timezone stuff completely within cx_Oracle -- a lot of that seems black magic to me which is why I > haven't attempted it. :-) Are there any other modules that have implemented this sort of thing? I don't know. > I know you can get at the > timezone for the session by "select sessiontimezone from dual". Actually what I need isn't the current timezone, but the timezone of a TIMESTAMP WITH TIME ZONE field. When the record is inserted this field would be set to SYSTIMESTAMP. The content of this record will be published by a CherryPy webserver and I want to send a proper Last-Modified header which requires an UTC timestamp so I have to substract the timezone offset. > If you know what to do with that perhaps I can add the code > to cx_Oracle -- naturally Oracle has a different > concept of time zones than Python does which makes it a little more difficult. Comments? There seems to be a OCIDateTimeGetTimeZoneOffset() in ociap.h. This function returns the hour and minute timezone offset and a DateTime object. I tried putting a call to this into DateTimeVar.c::DateTimeVar_GetValue(), but that didn't work. I also don't know what OCIDateTimeGetTimeZoneOffset() does if the datetime object doesn't have a timezone. In fact I don't even know if OCIDateTimeGetTimeZoneOffset() is the correct function. :-/ Servus, Walter |