Skip to content

Instantly share code, notes, and snippets.

@benpdavison
Created August 24, 2018 11:27
Show Gist options
  • Save benpdavison/ecc81589116c241e5ba8b19ef6b3e0ea to your computer and use it in GitHub Desktop.
Save benpdavison/ecc81589116c241e5ba8b19ef6b3e0ea to your computer and use it in GitHub Desktop.
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
class EPOCToISO {
public static void main(String[ ] args) {
Long epoch = 1535109390070L;
Instant i = Instant.ofEpochMilli(epoch);
ZonedDateTime z = ZonedDateTime.ofInstant(i, ZoneOffset.UTC);
System.out.println(DateTimeFormatter.ISO_INSTANT.format(z));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment