Here you can find the source of getCurrentMonthday()
public static List<String> getCurrentMonthday()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class Main { /** //from w w w . j a v a 2 s .c o m * @Title: getCurrentMonthday * @Description: TODO * @author alterhu2020@gmail.com * @param @return * @return List<String> return type * @throws */ public static List<String> getCurrentMonthday() { List<String> currentmonth = new ArrayList<String>(); Calendar c = Calendar.getInstance(); int totalday = c.getActualMaximum(Calendar.DAY_OF_MONTH); System.out.println("current month total day is :" + totalday); c.set(Calendar.DAY_OF_MONTH, 1); System.out.println("first day is :" + new SimpleDateFormat("yyyy-MM-dd").format(c.getTime())); //currentmonth.add(new SimpleDateFormat("yyyy-MM-dd").format(c.getTime())); for (int index = 1; index <= totalday; index++) { c.set(Calendar.DAY_OF_MONTH, index); currentmonth.add(new SimpleDateFormat("yyyy-MM-dd").format(c.getTime())); } return currentmonth; } }