diff --git a/common-common/pom.xml b/common-common/pom.xml index 6dc707f..06134ea 100644 --- a/common-common/pom.xml +++ b/common-common/pom.xml @@ -6,7 +6,7 @@ cn.axzo.framework common-common - 1.0.11 + 1.0.12 UTF-8 @@ -22,7 +22,6 @@ 3.3.2 1.18.18 1.2.47 - 2.10.6 5.5.7 2.10.2 6.5.0 @@ -105,12 +104,6 @@ ${spring.version} provided - - joda-time - joda-time - ${joda-time.version} - provided - javax.servlet javax.servlet-api diff --git a/common-common/src/main/java/cn/azxo/framework/common/utils/DateUtils.java b/common-common/src/main/java/cn/azxo/framework/common/utils/DateUtils.java index 23c25a6..0757eec 100644 --- a/common-common/src/main/java/cn/azxo/framework/common/utils/DateUtils.java +++ b/common-common/src/main/java/cn/azxo/framework/common/utils/DateUtils.java @@ -1,9 +1,9 @@ package cn.azxo.framework.common.utils; -import org.joda.time.DateTime; - import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.Date; /** @@ -23,9 +23,9 @@ public abstract class DateUtils { * @return */ public static Date plusHour(int hour) { - DateTime dateTime = DateTime.now(); - DateTime afterPlus = dateTime.plusHours(hour); - return afterPlus.toDate(); + LocalDateTime ldt = LocalDateTime.now(); + LocalDateTime afterPlus = ldt.plusHours(hour); + return Date.from(afterPlus.atZone(ZoneId.systemDefault()).toInstant()); } /** @@ -35,9 +35,11 @@ public abstract class DateUtils { * @return */ public static Date plusHour(Date date, int hour) { - DateTime dateTime = new DateTime(date); - DateTime afterPlus = dateTime.plusHours(hour); - return afterPlus.toDate(); + LocalDateTime ldt = date.toInstant() + .atZone( ZoneId.systemDefault() ) + .toLocalDateTime(); + LocalDateTime afterPlus = ldt.plusHours(hour); + return Date.from(afterPlus.atZone(ZoneId.systemDefault()).toInstant()); } public static Date parseY14S(String pattern){