Re: Strange timezone issue on Freebsd

From: "Jan Aleman" <jaleman(at)profdata(dot)nl>
To: "'pgsql-jdbc'" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Strange timezone issue on Freebsd
Date: 2002-03-18 22:19:26
Message-ID: 000b01c1ceca$f9263170$2b01000a@jaleman
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)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(at)postgresql(dot)org
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message bef5471 2002-03-19 02:46:29 cgi
Previous Message Jan Aleman 2002-03-18 20:21:52 Strange timezone issue on Freebsd