Browse Source

时间工具类

develop
wangsixiang 8 months ago
parent
commit
51e1b4dc0c
  1. 12
      ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

12
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;
}
}

Loading…
Cancel
Save