반응형

Spring Boot 에서 TimeZone 설정하려면 아래와 같이 @PostConStruct를 설정해주면 된다.

 

 @SpringBootApplication public class Application {  	@PostConstruct 	void started() { 		TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul")); 	}  	public static void main(String[] args) { 		SpringApplication.run(Application.class, args);  	}  } 
반응형

UTC를 원한다면 TimeZone.getTimeZone("UTC")라고 하면 된다.

 

시간을 KST로 설정하고싶어서 TimeZone.getTimeZone("KST")라고 계속 했는데 안되서 삽질한 경험이 있다. KST라고하면 안되고

한국 시간 설정은 Asia/Seoul로 설정해주면 된다.

 

그 외 example timezone offset은 아래의 사이트에서 확인할 수 있다.

https://docs.oracle.com/javase/tutorial/datetime/iso/timezones.html

반응형

+ Recent posts