Created
March 25, 2018 09:23
-
-
Save micheleb/c8d198b46181e676fd5619d79d6132d7 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 class TimezoneChange { | |
private static final ZoneId ZONE = ZoneId.of("Europe/Madrid"); | |
private static final DateTimeFormatter TIME_FORMATTER = new DateTimeFormatterBuilder() | |
.appendPattern("yyyy-MM-dd'T'HH:mm:ss") | |
.appendFraction(MILLI_OF_SECOND, 0, 3, true) | |
.toFormatter(); | |
public static void main(String[] args) { | |
Instant converted = ZonedDateTime.of(LocalDateTime.parse(startDate, TIME_FORMATTER), ZONE).toInstant(); | |
System.out.println("after changing time zone: " + converted); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment