diff --git a/chunjun-core/src/main/java/com/dtstack/chunjun/util/DateUtil.java b/chunjun-core/src/main/java/com/dtstack/chunjun/util/DateUtil.java index f6fbc466b8..688c30f6d0 100644 --- a/chunjun-core/src/main/java/com/dtstack/chunjun/util/DateUtil.java +++ b/chunjun-core/src/main/java/com/dtstack/chunjun/util/DateUtil.java @@ -48,6 +48,9 @@ public class DateUtil { private static final String TIME_ZONE = "GMT+8"; + private static final boolean isUseLocalTimeZone = + Boolean.parseBoolean(System.getProperty("USE_LOCAL_TIMEZONE")); + private static final String STANDARD_DATETIME_FORMAT = "standardDatetimeFormatter"; private static final String STANDARD_DATETIME_FORMAT_FOR_MILLISECOND = @@ -97,7 +100,12 @@ public class DateUtil { public static ThreadLocal> datetimeFormatter = ThreadLocal.withInitial( () -> { - TimeZone timeZone = TimeZone.getTimeZone(TIME_ZONE); + TimeZone timeZone; + if (isUseLocalTimeZone) { + timeZone = TimeZone.getDefault(); + } else { + timeZone = TimeZone.getTimeZone(TIME_ZONE); + } Map formatterMap = new HashMap<>(); SimpleDateFormat standardDatetimeFormatter =