Subject | time zone problem |
---|---|
Author | rwilcom |
Post date | 2004-07-28T17:22:53Z |
Has anyone noticed time zone bugs when using the JDBC driver
(FirebirdSQL-1.5.0Beta3JDK_1.4). I am using a date/time field in
the database and using a simple prepared statement to set the
timestamp object (example to follow):
Date testDateTime= format.parse("02-10-2004 10:00:00 EST");
ps.setTimestamp(1, new java.sql.Timestamp( testDateTime.getTime()),
GMT );
When my OS running Firebird is set to EST I get "2004-02-10
05:00:00" written to the date/time field? This should have been "02-
10-2004 15:00:00" if properly written in GMT.
If I change my OS running Firebird to GMT and run the same code I
get "02-10-2004 15:00:00"!? So, therefore, the driver is improperly
using the machine's current timezone in the calculatation for
date/time to insert?
This is incorrect, if GMT is specified in the 'setTimestamp' method
then GMT should always be written the same way since the value
passed into the Timestamp object in UTC based (java Data object is
UTC only) - regardless of the machine's time zone setting (?).
Anyone else see this - anyone else have a problem trying to insert
timestamps in GMT? This seems like it would be a common problem.
(FirebirdSQL-1.5.0Beta3JDK_1.4). I am using a date/time field in
the database and using a simple prepared statement to set the
timestamp object (example to follow):
Date testDateTime= format.parse("02-10-2004 10:00:00 EST");
ps.setTimestamp(1, new java.sql.Timestamp( testDateTime.getTime()),
GMT );
When my OS running Firebird is set to EST I get "2004-02-10
05:00:00" written to the date/time field? This should have been "02-
10-2004 15:00:00" if properly written in GMT.
If I change my OS running Firebird to GMT and run the same code I
get "02-10-2004 15:00:00"!? So, therefore, the driver is improperly
using the machine's current timezone in the calculatation for
date/time to insert?
This is incorrect, if GMT is specified in the 'setTimestamp' method
then GMT should always be written the same way since the value
passed into the Timestamp object in UTC based (java Data object is
UTC only) - regardless of the machine's time zone setting (?).
Anyone else see this - anyone else have a problem trying to insert
timestamps in GMT? This seems like it would be a common problem.