Re: UTC, time zone support for datetimes
Posted in 1999
On Fri, 12 Feb 1999, Andrew Pimlott wrote: > In article <36C3C021.42D8@earthlink.net>, Jonathan Leffler wrote: > >> Is there any way of asking the database for (the equivalent of) > >> the current time in UTC? (It is essential to use the database's > >> clock to avoid skew among applications using the database.) > > > >Not easily. You have to work some magic on the timezone to determine > >the current offset to UTC, and then manually apply that correction. > > You don't mean you can get the offset from the database, do you? I don't, know. That's why there's magic involved. > I assume you're suggesting figuring out the offset in the application. > There will of course still be a brief window when you get it wrong, but > at least it's less than an hour. Yes, using the TZ variable (which can be difficult if it is set to US/Pacific as it is on my machine).; > If you mean I can get the database's idea of the offset (simultaneous to > getting it's idea of the time), let me know how. See the undocumented features in the attachment. The Anonymous people are from scattered locations, several of them in Europe (so English is not their first language). I'm not sure whether this is any help to you whatsoever, and since it is undocumented, it is equally unsupported. > >SQL-92 has DATETIME values with timezone appendages, but not at the > >entry level. > > I know--I keep two SQL-92 books next to me because I need to write > as-portable-as-possible database code. Most of what's in those books isn't > in any database I've seen, after six years. > > >Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) > >Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN > ^^^^^^^^^^^^^ > Wow, you're everywhere! I have a DBD::Informix question, but I'll take it > to the right list.... No, only in c.d.i for general Informix issues, and dbi-users@fugue.com for DBD::Informix. But thanks for asking DBD::Informix questions in the correct forum. Yours, Jonathan Leffler (jleffler@informix.com) #include <wish/I/was/skiing.h> Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn