improve performance of time zone lookup

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-02-16 10:19:54 +00:00
parent 9e85169bdf
commit 3f3d194689
1 changed files with 2 additions and 2 deletions

View 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();
}