diff --git a/core/src/main/java/lucee/runtime/functions/international/LSParseDateTime.java b/core/src/main/java/lucee/runtime/functions/international/LSParseDateTime.java index d8696f7e90..a135a7fa8e 100644 --- a/core/src/main/java/lucee/runtime/functions/international/LSParseDateTime.java +++ b/core/src/main/java/lucee/runtime/functions/international/LSParseDateTime.java @@ -77,19 +77,14 @@ private static lucee.runtime.type.dt.DateTime _call(PageContext pc, Object oDate String strDate = StringUtil.replaceSpecialWhiteSpace(Caster.toString(oDate)); if (format != null && "epoch".equalsIgnoreCase(format.trim())) { - String seconds = oDate.toString(); - long timeSeconds = Long.parseLong(seconds); - long milliseconds = timeSeconds*1000; - Instant instant = Instant.ofEpochMilli(milliseconds); + Instant instant = Instant.ofEpochMilli(Long.parseLong(oDate.toString()) * 1000); LocalDateTime localDateTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); strDate = StringUtil.replaceSpecialWhiteSpace(Caster.toString(localDateTime)); return DateCaster.toDateTime(locale, strDate, tz, isUSLike(locale)); } + else if (format != null && "epochms".equalsIgnoreCase(format.trim())) { - String seconds = oDate.toString(); - long timeSeconds = Long.parseLong(seconds); - long milliseconds = timeSeconds; - Instant instant = Instant.ofEpochMilli(milliseconds); + Instant instant = Instant.ofEpochMilli(Long.parseLong(oDate.toString())); LocalDateTime localDateTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); strDate = StringUtil.replaceSpecialWhiteSpace(Caster.toString(localDateTime)); return DateCaster.toDateTime(locale, strDate, tz, isUSLike(locale)); @@ -139,4 +134,4 @@ public static final boolean isUSLike(Locale locale) { if (locale == null) return false; return locale.getLanguage().equalsIgnoreCase("en") && (StringUtil.isEmpty(locale.getCountry()) || "US".equalsIgnoreCase(locale.getCountry())); } -} \ No newline at end of file +}