-1

I want to change serverTimezone to GMT+3. I try this but not working

spring.datasource.url=jdbc:mysql://localhost:3306/example?useSSL=false&serverTimezone=GMT+3&useLegacyDatetimeCode=false
Caused by: java.sql.SQLException: No timezone mapping entry for 'GMT 3'

but if I run this it is working with GMT-3

spring.datasource.url=jdbc:mysql://localhost:3306/example?useSSL=false&serverTimezone=GMT-3&useLegacyDatetimeCode=false

how can I change this to GMT+3 ?

hasankzl
  • 666
  • 4
  • 16

1 Answers1

-2

Please Override PostConstruct in Main Boot App as below

@PostConstruct
public void init()
{
    TimeZone.setDefault(TimeZone.getTimeZone("Asia/Kolkata"));   
}

Replace Asia/Kolkata with your timezone

Janam Soni
  • 12
  • 1
  • Setting the JVM default timezone is something entirely different from configuring the MySQL server time zone. Doing this could break applications that were built with a specific expectation with regard to the JVM default timezone. – Mark Rotteveel May 07 '19 at 11:04