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());
'java' 카테고리의 다른 글
List to array & array to List, Ser to array & array to Ser (0) | 2018.10.29 |
---|---|
JAVA - 유니코드를 한글(문자열)로 변환 (0) | 2018.09.17 |
현재 디렉토리 절대경로 구하기 (0) | 2017.11.23 |
java - telnet 대신 포트 방화벽 확인하기 port check (0) | 2017.11.22 |
65279 character java (0) | 2017.07.10 |