Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

H2 set default time zone

How can I set the time zone of H2 database? I'm using Hibernate for creating the database.

like image 908
Alberto Avatar asked Jan 07 '13 20:01

Alberto


People also ask

How do I change the timezone on my H2 database?

Apparently you don't have a parameter on the connection but the database will use the timezone of the JVM where the driver is loaded so you can set -Duser. timezone=UTC . Note that you can't change the timezone after the driver has been loaded.

How do I change the timezone in spring boot?

Timezone as a URL Paramspring: datasource: url: jdbc:mysql://localhost:3306/test?connectionTimeZone=UTC username: root password: Also, we can, of course, configure the datasource with Java configuration instead.

What is the date format in H2 database?

The format is hh:mm:ss[. nnnnnnnnn].

What is H2 Database good for?

H2 Database Engine is the in-memory database for your automated tests. H2 Database Engine is primarily used for running application test cases by our development team.


1 Answers

EDIT: I found out my answer is probably incorrect, misleading at the very least. I tried to delete it, but apparently it is not possible.

Please see instead: How to store date/time and timestamps in UTC time zone with JPA and Hibernate

like image 101
gd1 Avatar answered Sep 19 '22 15:09

gd1