Re: [JDBC] JDBC Driver and timezones

Discussion in 'Java' started by Lew, May 19, 2010.

  1. Lew

    Lew Guest

    Kris Jurka
    >> I think the problem is that the Java specification for java.sql.Time
    >> requires that the date portion be filled in with 1970-01-01. So when
    >> trying to determine the zone shift to apply when printing it out, it is
    >> checking with that date instead of today's date as you are expecting.
    >>
    >> When reading a timetz value in, we don't need to determine what the zone
    >> shift is, it's explicit, so in this case we shift by the explicit DST
    >> amount. When printing it back out, the original zone offset has been
    >> discarded and we shift by the non-DST amount because the date 1970-01-01
    >> doesn't use DST. I think we'd like to be able to override the
    >> getTimezoneOffset value for the Time object, but there's no easy way to
    >> do that without creating our own PgTime object.


    On 05/19/2010 06:43 AM, John Lister wrote:
    > Hi, I spotted an issue regarding Daylight savings and timezones a while
    > ago that affected UK times so it may be possible that it does the same
    > in German ones. From memory - essentially the driver uses the epoch date
    > to work out DST which unfortunately coincides with a year (1970) when
    > the UK temporarily changed its DST rules.


    This issue came up in pgsql.interfaces.jdbc and it seemed worth bringing into
    the wider Java world since it's not Postgres-specific. The problem is that
    java.sql.Time values are date-agnostic so might not reflect the intended DST
    offset when referencing times relevant to "now".

    This might be worth a bug report, or perhaps the problem is intractable and
    requires the explicit workaround that the database folks find they must use.
    Perhaps the new date/time libraries will address this somehow.

    Opinions or assessments?

    --
    Lew
    Lew, May 19, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Konrad Piersdorfer

    NetBeans and MySQL-JDBC-Driver

    Konrad Piersdorfer, Sep 1, 2003, in forum: Java
    Replies:
    0
    Views:
    814
    Konrad Piersdorfer
    Sep 1, 2003
  2. Liz
    Replies:
    3
    Views:
    990
  3. Betty
    Replies:
    1
    Views:
    9,839
    Juha Laiho
    May 21, 2005
  4. Bruce
    Replies:
    4
    Views:
    730
    Bjorn Abelli
    Mar 25, 2006
  5. Kermit Piper
    Replies:
    0
    Views:
    687
    Kermit Piper
    Jun 11, 2006
Loading...

Share This Page