Here you can find the source of getCurrentWeekDays()
public static List<String> getCurrentWeekDays()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class Main { /**/*w w w .j a v a 2s.com*/ * @Title: getCurrentWeekDays * @Description: TODO * @author alterhu2020@gmail.com * @param @return * @return List<String> return type * @throws */ public static List<String> getCurrentWeekDays() { List<String> currentweek = new ArrayList<String>(); for (int kindex = 1; kindex <= 7; kindex++) { Calendar c = Calendar.getInstance(); int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1; if (day_of_week == 0) day_of_week = 7; c.add(Calendar.DATE, -day_of_week + kindex); String currentday = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); currentweek.add(currentday); } return currentweek; } }