Created
December 10, 2018 01:54
-
-
Save perforb/fa5fb9b8b0161e819015470df24bbc39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
Instant instant = Instant.ofEpochMilli(System.currentTimeMillis()); | |
String timeZone1 = ZoneId.SHORT_IDS.get("CST"); | |
String timeZone2 = ZoneId.SHORT_IDS.get("JST"); | |
String timeZone3 = "UTC"; | |
ZonedDateTime zonedDateTime1 = ZonedDateTime.ofInstant(instant, ZoneId.of(timeZone1)); | |
ZonedDateTime zonedDateTime2 = ZonedDateTime.ofInstant(instant, ZoneId.of(timeZone2)); | |
ZonedDateTime zonedDateTime3 = ZonedDateTime.ofInstant(instant, ZoneId.of(timeZone3)); | |
System.out.println(String.format("%2s:%2s %s", zonedDateTime1.getHour(), zonedDateTime1.getMinute(), zonedDateTime1)); | |
System.out.println(String.format("%2s:%2s %s", zonedDateTime2.getHour(), zonedDateTime2.getMinute(), zonedDateTime2)); | |
System.out.println(String.format("%2s:%2s %s", zonedDateTime3.getHour(), zonedDateTime3.getMinute(), zonedDateTime3)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19:53 2018-12-09T19:53:43.916-06:00[America/Chicago] | |
10:53 2018-12-10T10:53:43.916+09:00[Asia/Tokyo] | |
1:53 2018-12-10T01:53:43.916Z[UTC] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment