Skip to content

Instantly share code, notes, and snippets.

@yenerm
Created June 16, 2020 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yenerm/98dc4074256fe57f86b67662d1110095 to your computer and use it in GitHub Desktop.
Save yenerm/98dc4074256fe57f86b67662d1110095 to your computer and use it in GitHub Desktop.
ZonedDateTime Sample
<!-- 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