private static List<String> getWeekDay() { Calendar calendar = Calendar.getInstance(); while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { calendar.add(Calendar.DAY_OF_WEEK, -1); } List<String> list = new ArrayList<>(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); for (int i = 0; i < 7; i++) { list.add(dateFormat.format(calendar.getTime())); calendar.add(Calendar.DATE, 1); } return list; }
获取当前周的每一天
最新推荐文章于 2024-05-07 15:25:55 发布