Re: Strange timezone issue on Freebsd - Mailing list pgsql-jdbc

From Jan Aleman
Subject Re: Strange timezone issue on Freebsd
Date
Msg-id 000b01c1ceca$f9263170$2b01000a@jaleman
Whole thread Raw
In response to Strange timezone issue on Freebsd  ("Jan Aleman" <jaleman@profdata.nl>)
List pgsql-jdbc
I've just found the solution for this, not sure why but the JDK 1.4 does
by default not use the system's timezone.

By starting java with -Duser.timezone=CET I fixed this issue.


Jan Aleman

> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jan Aleman
> Sent: Monday, March 18, 2002 9:22 PM
> To: 'pgsql-jdbc'
> Subject: [JDBC] Strange timezone issue on Freebsd
>
>
> Strange timezone issue on Freebsd
>
> Setup:
>
> FreeBSD 4.5
> JDK 1.4 (linux port)
> Postgresql: 7.1
> Timezone on server: CET (GMT+1)
> (additionally also TZ=CET in environment)
>
> TABLE:
>
>                  Table "supplier_avail"
>      Attribute     |           Type           | Modifier
> -------------------+--------------------------+----------
>  supplier_avail_id | integer                  | not null
>  supplier_id       | integer                  | not null
>  weekday           | integer                  | not null
>  start_time        | timestamp with time zone |
>  end_time          | timestamp with time zone |
> Index: supplier_avail_pkey
>
> The query (when executed from psql):
>
> SELECT MIN(start_time) from supplier_avail where supplier_id
> = 1023 and weekday = 2
>
> Returns:
>
> 2001-01-01 09:00:00+01
>
> Now the problem:
> Consider the following Java snippet:
>
> IContentList openCL = cm.getContentByQuery(
>                 " SELECT"+
>                 " MIN(start_time)"+
>                 " from supplier_avail where supplier_id =
> "+supplier_id+" and weekday = "+weekday,1);
> out.print(openCL.getValueAt(0,0));
>
> returns:
> 2001-01-01 08:00:00.0
>
> The funny thing is if I connect from my Windows XP machine
> (Timezone also at GMT +1) the time I really want (09:00) is returned.
>
> I have scanned through the docs but was unable to find out if
> I'm doing something wrong.
>
> Thanks for helping me out
>
> Jan Aleman
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>


pgsql-jdbc by date:

Previous
From: "Jan Aleman"
Date:
Subject: Strange timezone issue on Freebsd
Next
From: bef5471
Date:
Subject: cgi