Reputation: 526
In a Java Tomcat application, I am using -Duser.timezone=Canada/Central
. Also, I setup server timezone to Canada/Central
. However, when I save timestamp to the database, using LocalDateTime.now()
, the UTC timestamp is being saved to the database.
Anyone has idea what's going wrong?
Thanks.
Upvotes: 0
Views: 130
Reputation: 526
I think, I found an elegant solution.
In jdbc connection string, adding the following parameters:
useLegacyDatetimeCode=false&serverTimezone=America/Winnipeg
Upvotes: 2