Set default timezone H2 database

前端 未结 6 1510
谎友^
谎友^ 2020-12-16 00:46

How can I explicitly set the time zone H2 should use? Now it gets the timezone to use from the underlying OS. I would assume there existed an extra parameter I would add to

6条回答
  •  长情又很酷
    2020-12-16 00:54

    H2 uses JVM timezone and it affects your Date calculation. If you are using it in Junits for example, you can set a certain timezone then re-put initial value when done. Example:

    System.setProperty("user.timezone", "GMT-3");
    TimeZone.setDefault(null);
    

提交回复
热议问题