Hi, Thanks a lot for the test case! I can reproduce the problem now, and I'm working on a solution.
Currently, H2 converts the timestamp to the local timezone before getting the fields (year, month, day, hour,...). This is doesn't work in this case, as the converted time doesn't actually exist (due to summer time change; it's 02:15 am). I think I can fix this in the next release. Of course I will add your test case (plus a few more). Regards, Thomas On Wed, Aug 17, 2011 at 10:42 AM, Noel Grandin <[email protected]> wrote: > I don't know what is wrong, but this is a test-case that shows the problem, > to be used in the TestDateStorage class > > private void testXXX() throws SQLException { > Connection conn = getConnection("date"); > TimeZone defaultTimeZone = TimeZone.getDefault(); > Statement stat = conn.createStatement(); > stat.execute("create table test(ts timestamp primary key)"); > try { > TimeZone.setDefault(TimeZone.getTimeZone("PST")); > DateTimeUtils.resetCalendar(); > java.sql.Timestamp date1 = java.sql.Timestamp.valueOf("2010-03-13 > 18:15:00"); > java.sql.Timestamp date2 = java.sql.Timestamp.valueOf("2010-03-13 > 19:15:00"); > Calendar utcCalendar = new GregorianCalendar(new > SimpleTimeZone(0, "Z")); > PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST > VALUES(?)"); > prep.setTimestamp(1, new java.sql.Timestamp(date1.getTime()), > utcCalendar); > prep.execute(); > prep.setTimestamp(1, new java.sql.Timestamp(date2.getTime()), > utcCalendar); > prep.execute(); > } finally { > TimeZone.setDefault(defaultTimeZone); > DateTimeUtils.resetCalendar(); > } > conn.close(); > deleteDb("date"); > } > > > Jamie Clark wrote: >> 2010-03-13 18:15 > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
