From: PJ Fanning Date: Wed, 16 Feb 2022 10:19:54 +0000 (+0000) Subject: improve performance of time zone lookup X-Git-Tag: REL_5_2_1~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f3d194689a21a81325240a3810e3dc6956bb81c;p=poi.git improve performance of time zone lookup git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898125 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java b/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java index 7a50951ac7..154127a50c 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java @@ -93,7 +93,7 @@ public class DateUtil { */ public static LocalDateTime toLocalDateTime(Date date) { return date.toInstant() - .atZone(TimeZone.getTimeZone(ZoneOffset.UTC).toZoneId()) // java.util.Date uses UTC + .atZone(LocaleUtil.TIMEZONE_UTC.toZoneId()) // java.util.Date uses UTC .toLocalDateTime(); } @@ -104,7 +104,7 @@ public class DateUtil { */ public static LocalDateTime toLocalDateTime(Calendar date) { return date.toInstant() - .atZone(TimeZone.getTimeZone(ZoneOffset.UTC).toZoneId()) // java.util.Date uses UTC + .atZone(LocaleUtil.TIMEZONE_UTC.toZoneId()) // java.util.Date uses UTC .toLocalDateTime(); }