diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java index b67b57b9..b6f7bd65 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java @@ -8,6 +8,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.util.Calendar; import java.util.Date; import org.apache.commons.lang3.time.DateFormatUtils; @@ -184,4 +185,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); } + /** + * 获取当前时间,time分钟后的时间 + */ + public static Date getObtainDateAfter(int time){ + Date now = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(now); + calendar.add(Calendar.MINUTE, time); + Date fiveMinutesLater = calendar.getTime(); + return fiveMinutesLater; + } }