zhaojunjie163 / gist

Since my company blocks gist.github.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZoneId utcZone = ZoneId.of("UTC").normalized();
ZonedDateTime utcTime = ZonedDateTime.of(LocalDateTime.now(Clock.systemUTC()), utcZone);
 
// To LocalDate by ZoneOffset
utcTime.withZoneSameInstant(ZoneOffset.of("-07:00")).toLocalDate();
 
// To LocalDateTime by ZoneId
utcTime.withZoneSameInstant(ZoneId.of("Asia/Singapore")).toLocalDateTime();

About

Since my company blocks gist.github.com


Languages

Language:Shell 100.0%