RE: BUG for date

"Christopher Brown" <[email protected]>
Newsgroups gmane.comp.db.mckoi
Message-ID <[email protected]>
So it's best not to use PreparedStatement.setDate (or Timestamp) and the
corresponding "getters" in ResultSet ?

Incidentally, Date has performance problems due to it being mutable
(everything passes through an internal synchronization bottleneck).   The
"joda-time" project on sourceforge provides a credible alternative that
might be useful internally.

Any news on an upcoming release with enhanced date support (timezones, date
functions, etc.)..?  "1.0.3"'s been around a while now...

- Chris 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tobias
Downer
Sent: 11 February 2005 03:13
To: [email protected]
Subject: Re: BUG for date

Unfortunately java.sql.Date is derived from java.util.Date and therefore
inherits the timezone properties as well.  Since java.util.Date is
primitively based on a universal time system (number of milliseconds since
Jan 1st, 1970) using getDate on a client where the timezone is not the same
as the server can be problematic.  Mckoi also primitively uses the same
system to store dates and currently simply passes that value from server to
client.  Technically the JDBC driver should convert the date to the local
timezone and we plan to change the current behaviour.

One way to manage dates in a universal time zone format is to cast the date
to a string in the SQL query.  For example;

   SELECT CAST(my_date AS TEXT) FROM my_table

With the above query, since the string format will be generated on the
server there will be no conversion problems if the time zone on the client
is different.

Toby.


Pascal Paradis-Théberge wrote:

> I thought java.sql.Date had no time component (the time fields are all 
> set to 0) so from this it follows that it doesn't matter which 
> timezone the client machine is in, a date should be the same.
> 
> Or am I missing something?
> 
> Pascal
> 
> Patrick wrote:
> 
>>Well no.  The date is NOT the date across timezones.  In the US for 
>>instance the date changes one hour earlier in the east than it does in 
>>the US Central timezone.
>>
>>-----Original Message-----
>>From: [email protected] [mailto:[email protected]] On Behalf Of Gorazd 
>>Praprotnik
>>Sent: Thursday, February 10, 2005 2:34 PM
>>To: [email protected]
>>Subject: Re: BUG for date
>>
>>Hi, Rick.
>>
>>Yes, you are right. If I change timezone, values are right. Thank you 
>>for replay. But for me is still bug, because date is date, and it must 
>>be same in every time zone. I'd tested with other drivers and things 
>>worked fine.
>>I think you shoud repair this bug, even it is more academic issue. 
>>Thank you again.
>>
>>Have a nice day.
>>
>>Gorazd



---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/ To
unsubscribe, send a message to [email protected]





---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.