Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1B4221337BC5 for ; Fri, 7 Jan 2011 12:55:11 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 60504-06 for ; Fri, 7 Jan 2011 16:55:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from progressive.micfo.com (progressive.micfo.com [67.23.244.116]) by mail.postgresql.org (Postfix) with ESMTP id B93461337BC2 for ; Fri, 7 Jan 2011 12:55:10 -0400 (AST) Received: from 87-204-194-135.dg-net.pl ([87.204.194.135]:55019 helo=radek.localnet) by progressive.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PbFac-0006NB-Aj; Fri, 07 Jan 2011 11:54:58 -0500 From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: Strange behaviour of rs.getTimestamp Date: Fri, 7 Jan 2011 17:54:51 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.36-gentoo-r5; KDE/4.4.5; x86_64; ; ) Cc: Altaf Malik , Kevin Grittner , Samuel Gendler References: <416690.93407.qm@web110406.mail.gq1.yahoo.com> <4D25D92702000025000390A0@gw.wicourts.gov> <948897.28558.qm@web110410.mail.gq1.yahoo.com> In-Reply-To: <948897.28558.qm@web110410.mail.gq1.yahoo.com> MIME-Version: 1.0 Message-Id: <201101071754.52152.rsmogura@softperience.eu> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - progressive.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201101/19 X-Sequence-Number: 21351 Hi, I think it's DST maybe you missed something. I didn't search deaply.=20 https://bugzilla.redhat.com/show_bug.cgi?id=3D495473 Did you missed something, about DST? Kind regards, Rados=C5=82aw Smogura http://softperience.eu Altaf Malik Friday 07 January 2011 16:31:26 > Here is the output of the program run. I also included user.timezone >=20 > Sun Microsystems Inc. > 1.6.0_21 > Java HotSpot(TM) 64-Bit Server VM > mixed mode > TimeZone:Asia/Karachi > 2009-04-15 00:00:00->2009-04-15 01:00:00.0 >=20 > I am using UBUNTU 10.10 64 bit. > I don't see this behaviour with other timezones. For example, I set my TZ > to PST, GMT and the values were correct. >=20 >=20 > I debugged little further and found that the value is changed in the > following code: >=20 > Calendar c =3D new GregorianCalendar(); > c.set(Calendar.ERA, 1); > c.set(Calendar.YEAR, 2009); > c.set(Calendar.MONTH, 4-1); > c.set(Calendar.DAY_OF_MONTH, 15); > c.set(Calendar.HOUR_OF_DAY, 0); > c.set(Calendar.MINUTE, 0); > c.set(Calendar.SECOND, 0); > c.set(Calendar.MILLISECOND, 0); > Timestamp ts =3D new Timestamp(c.getTime().getTime()); >=20 > In the specific scenario, if you print ts, it shows hour value as 1 only= =20 > on this specific date. So obviously, something seems wrong with JDK or my > timezone data. >=20 > My point is, that when we don't want the value interpreted in different > timezones (we are using timestamp and not timestamp with timezone), we > should not use Calander to convert value to a timestamp when we exactly > have year,month,day,hour,minute and second values. >=20 > -- Altaf Malik >=20 >=20 >=20 > ________________________________ > From: Kevin Grittner > To: Altaf Malik > Cc: Samuel Gendler ; pgsql-jdbc@postgresql.org > Sent: Fri, January 7, 2011 2:00:55 AM > Subject: Re: [JDBC] Strange behaviour of rs.getTimestamp >=20 > Samuel Gendler wrote: > > It might also be potentially revealing if you print out the > > default timezone and locale for the jvm in question as well. >=20 > Good point. In addition to the system properties printed from what > I posted, please include the "user.timezone" system property. >=20 > -Kevin