|
@@ -465,6 +465,7 @@ public class DateUtils {
|
|
|
System.out.println(time2);
|
|
|
System.out.println(getDurationHoursStr(time, time2));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* date 转 LocalDate
|
|
|
*
|
|
@@ -582,6 +583,39 @@ public class DateUtils {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ public static List<LocalDate> currentWeekDate(){
|
|
|
+ List<LocalDate> list = new ArrayList<>();
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ for(int i=-6;i<0;i++){
|
|
|
+ list.add(now.plusDays(i));
|
|
|
+ }
|
|
|
+ list.add(now);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取某年,制定之前6天的开始
|
|
|
+ *
|
|
|
+ * @param now
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static LocalDateTime getSixDayAgoOfDay(LocalDateTime now) {
|
|
|
+ LocalDateTime sevenDay = now.plusDays(-6);
|
|
|
+ LocalDateTime ldt = sevenDay.withHour(0).withMinute(0).withSecond(0);
|
|
|
+ return ldt;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取指定天的最后一秒钟
|
|
|
+ *
|
|
|
+ * @param now
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static LocalDateTime getLastDayOfDay(LocalDateTime now) {
|
|
|
+ LocalDateTime ldt = now.withHour(23).withMinute(59).withSecond(59);
|
|
|
+ return ldt;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|