https://wickso.me/2018/02/20/time-zone-with-java8/

http://www.daleseo.com/java8-zoned-date-time/

 

 

ZonedDateTime nowSeoul = ZonedDateTime.now(ZoneId.of("Asia/Seoul"));

LOG.info("{}", nowSeoul.toString());

 

ZonedDateTime nowLondon = ZonedDateTime.now(ZoneId.of("Europe/London"));

LOG.info("{}", nowLondon.toString());

 

LocalDate date = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String text = nowLondon.format(formatter);
LocalDate parsedDate = LocalDate.parse(text, formatter);

LOG.info("{}", parsedDate.toString());

 

LocalTime time = LocalTime.now();
formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
text = nowLondon.format(formatter);
LocalTime parsedTime = LocalTime.parse(text, formatter);

LOG.info("{}", parsedTime.toString());
 

Posted by 張's blog
,