From: Gavin_King/Cirrus%<CI...@ci...> - 2002-02-19 06:02:43
|
> In cirrus.hibernate.type.DateType the set method does: > st.setDate(index, new Date( ( (java.util.Date) value).getTime() ) ); >This will discard any Calendar associated with the Date, and >consequently any timezone associated with the Date. aaaaahhhh. Thank you! I had a suspicion there was something screwy going on with dates, but I couldn't figure it out (clueless about i18n issues) and no-one had reported problems..... >How can the jdbc driver extract the DATE portion of the 'milliseconds >since January 1, 1970 00:00:00 GMT' accurately if it doesn't know the >timezone? The jdbc driver could assume local time, or could assume >GMT, but neither of these is as satisfactory as pulling the timezone >from the original Date. So, what is the _correct_ way to translate a java.util.Date to a java.sql.Date. My apologies for ignorance of something I guess I really should know.....! I also just noticed that I overrode Type.equals(x, y) on DateType but not on TimeType or TimeStampType. Clearly I also need to reimplement equals(x,y) on TimeType. But is it also unsafe to use timestamp1.equals(timestamp2) considering the timezone issues you raise? |