Created
June 16, 2020 18:50
-
-
Save yenerm/98dc4074256fe57f86b67662d1110095 to your computer and use it in GitHub Desktop.
ZonedDateTime Sample
This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 → | |
ZonedDateTime currentDate = ZonedDateTime.now(); | |
System.out.println("the current zone is "+ currentDate.getZone()); | |
//the current zone is America/Los_Angeles | |
ZoneId anotherZone = ZoneId.of(“Europe/Istanbul”); | |
ZonedDateTime currentDateInIstanbul = currentZone.withZoneSameInstant(anotherZone); | |
//2020-06-08T23:50:00.159+03:00[Europe/Istanbul] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment