TimeZone in Spring Boot

https://www.notion.so/TimeZone-in-Spring-Boot-bcb5c63fd9d44f89b6d01845e84f5961

1
2
3
4
5
6
7
8
9
10
11
12
@SpringBootApplication
public class Application {
    @PostConstruct
    public void init(){
        // Setting Spring Boot SetTimeZone
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }
    
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

In application.properties

1
spring.jackson.time-zone= #  Time zone used when formatting dates. For instance, "America/Los_Angeles" or "GMT+10".
This post is licensed under CC BY 4.0 by the author.