> Please try to keep your responses short.

I promise to try, but I find clear and explicit communication in higher value
than the the sparsity of expression.

Now the documentation seems to me clear and concise.
It expresses everything in a pragmatic way using a concrete example.
Well done.

Still, I would propose a different implementation for the future
but I quess you knew that already ;-)

- Rami

The documentation at
http://h2database.com/html/tutorial.html#date_time is incorrect, I
will change it to :

"If the time zone is not set, the value is parsed using the current
time zone setting of the system. Date and time information is stored
in H2 database files without time zone information. If the database is
opened using another system time zone, the date and time will be the
same.
That means if you store the value '2000-01-01 12:00:00' in one time
zone, then close the database and open the database again in a
different time zone, you will also get '2000-01-01 12:00:00'. Please
note that changing the time zone after the H2 driver is loaded is not
supported."

Example:

TimeZone.setDefault(TimeZone.getTimeZone("PST"));
// TimeZone.setDefault(TimeZone.getTimeZone("CET"));
Class.forName("org.h2.Driver");
String dir = "~/data/h2database/h2/data";
String url = "jdbc:h2:" + dir + "/test";
Connection conn = DriverManager.getConnection(url);
Statement stat = conn.createStatement();
stat.execute("create table if not exists test(x timestamp)");
stat.execute("insert into test values('2000-01-01 12:00:00')");
conn.close();
conn = DriverManager.getConnection(url);
stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select * from test");
while(rs.next()) {
     System.out.println(rs.getString(1));
}

Regards,
Thomas


--
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.

Reply via email to