public static List<String> getLastThirtyDays(){
LocalDate localDate = LocalDate.now();
LocalDate afterDate = localDate.minusDays(30);
List<String> list = new ArrayList<>(30);
LocalDate currentdate = afterDate;
for (int i = 0; i< 30; i++){
currentdate = currentdate.plusDays(1);
LocalDate temp = LocalDate.of(currentdate.getYear(), currentdate.getMonth(), currentdate.getDayOfMonth());
list.add(temp.toString());
}
return list;
}
【java】获取最近30天
最新推荐文章于 2024-05-17 16:02:55 发布