Skip to Content.
Sympa Menu

freetds - Re: Reading DateTime in MSSQL (6.5) - BUG?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Craig Spannring <cts AT internetcds.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Reading DateTime in MSSQL (6.5) - BUG?
  • Date: Wed, 21 Apr 1999 10:54:03 -0600 (MDT)


joel_trunick AT dell.com writes:
>
> When reading dates in MSSQL, I consistently get a time 5 hours earlier
> than
> what is in the database. Is the code wrong, or is this a bug?

Let me guess, your timezone is 5 hours off of GMT.


>From the KNOWN_BUGS file-

The driver isn't properly handling timezone issues for Timestamp
columns. (What is the correct behavior since SQLServer doesn't
properly handle timezone issues either?) Demonstrated by
t0001.java.

All times coming back from SQLServer are in local time for the
server. Java stores time in GMT. The client has no
way of knowing what timezone the server is in and therefore can't
adjust to it to GMT.

The only hack I've thought of that would mostly work is to have the
JDBC driver do a SELECT GETDATE() the first time it opens the
connection. It could then compare what it thinks current GMT time is
to what the server thinks current local time is and try determine the
timezone offset from there. Of course this method fails when you go
into or out of daylight savings time. It also fails for some weird
timezones that aren't a multiple of an hour away from GMT.

--
=======================================================================
Life is short. | Craig Spannring
Bike hard, ski fast. | cts AT internetcds.com
--------------------------------+------------------------------------
Any sufficiently horrible technology is indistinguishable from Perl.
=======================================================================




Archive powered by MHonArc 2.6.24.

Top of Page