Created
October 6, 2020 14:48
-
-
Save a2ankitrai/312b5673d1657531144d2af11227a001 to your computer and use it in GitHub Desktop.
Creating LocalDateTime for UTC and CET Zone
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
private LocalDateTime getLocalZonedDateTime() { | |
Instant instant = Instant.now(); | |
ZonedDateTime zonedDateTime = instant.atZone(ZoneId.of(ZoneId.SHORT_IDS.get("ECT"))); | |
return zonedDateTime.toLocalDateTime(); | |
} | |
private LocalDateTime getCurrentUTCDateTime() { | |
return OffsetDateTime.now(ZoneOffset.UTC).toLocalDateTime(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment