|
|
@@ -29,4 +29,26 @@ public class LargeScreenDateUtils {
|
|
29
|
29
|
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
30
|
30
|
}
|
|
31
|
31
|
|
|
|
32
|
+ /**
|
|
|
33
|
+ * 获取指定月数前的日期
|
|
|
34
|
+ *
|
|
|
35
|
+ * @param months 月数
|
|
|
36
|
+ * @return 指定月数前的日期
|
|
|
37
|
+ */
|
|
|
38
|
+ public static Date getDateBeforeMonths(int months) {
|
|
|
39
|
+ LocalDate localDate = LocalDate.now().minusMonths(months);
|
|
|
40
|
+ return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
41
|
+ }
|
|
|
42
|
+
|
|
|
43
|
+ /**
|
|
|
44
|
+ * 获取指定年数前的日期
|
|
|
45
|
+ *
|
|
|
46
|
+ * @param years 年数
|
|
|
47
|
+ * @return 指定年数前的日期
|
|
|
48
|
+ */
|
|
|
49
|
+ public static Date getDateBeforeYears(int years) {
|
|
|
50
|
+ LocalDate localDate = LocalDate.now().minusYears(years);
|
|
|
51
|
+ return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
52
|
+ }
|
|
|
53
|
+
|
|
32
|
54
|
}
|