diff --git a/li.strolch.utils/src/main/java/li/strolch/utils/iso8601/ISO8601.java b/li.strolch.utils/src/main/java/li/strolch/utils/iso8601/ISO8601.java index d3a93e696..a198d300e 100644 --- a/li.strolch.utils/src/main/java/li/strolch/utils/iso8601/ISO8601.java +++ b/li.strolch.utils/src/main/java/li/strolch/utils/iso8601/ISO8601.java @@ -18,10 +18,7 @@ package li.strolch.utils.iso8601; import static java.time.ZoneId.systemDefault; import static java.time.temporal.ChronoField.*; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; +import java.time.*; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.SignStyle; @@ -175,6 +172,10 @@ public class ISO8601 implements DateFormat { return ZonedDateTime.parse(s, getIso8601Formatter(precision)); } + public static String toString(long timeMs) { + return toString(Instant.ofEpochMilli(timeMs).atZone(systemDefault())); + } + public static String toString(LocalDateTime localDateTime) { return toString(localDateTime.atZone(systemDefault())); }