From a9aa5d8ae19dd25aab6cd3bc9de81f632600660d Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 24 Apr 2018 14:15:59 +0700 Subject: [PATCH] Add Long.toDate() convenience method --- source/net/filebot/format/ExpressionFormatMethods.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index da62e3ce..1b6b7a59 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -15,7 +15,10 @@ import java.nio.file.Files; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; import java.text.Normalizer; +import java.time.Instant; +import java.time.LocalDateTime; import java.time.LocalTime; +import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.time.temporal.Temporal; import java.time.temporal.TemporalAmount; @@ -519,6 +522,10 @@ public class ExpressionFormatMethods { return attr.lastModifiedTime().toMillis(); } + public static LocalDateTime toDate(Long self) { + return LocalDateTime.ofInstant(Instant.ofEpochMilli(self), ZoneOffset.systemDefault()); + } + public static File toFile(String self) { if (self == null || self.isEmpty()) { return null;