]> source.dussan.org Git - poi.git/commitdiff
improve performance of time zone lookup
authorPJ Fanning <fanningpj@apache.org>
Wed, 16 Feb 2022 10:19:54 +0000 (10:19 +0000)
committerPJ Fanning <fanningpj@apache.org>
Wed, 16 Feb 2022 10:19:54 +0000 (10:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898125 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java

index 7a50951ac7eb6daba7a14ec042c75ffbe25bcfb4..154127a50c66586d5fc63153e8697250e527cbbf 100644 (file)
@@ -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();
     }