Here you can find the source of getAllDate(String year_month)
public static List<Object> getAllDate(String year_month)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class Main { public static List<Object> getAllDate(String year_month) { List<Object> list = new ArrayList<Object>(); Calendar rightNow = Calendar.getInstance(); SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy-MM"); try {/*from w w w .ja v a 2 s. com*/ rightNow.setTime(simpleDate.parse(year_month)); } catch (ParseException e) { e.printStackTrace(); } int days = rightNow.getActualMaximum(Calendar.DAY_OF_MONTH); String date = ""; for (int i = 1; i <= days; i++) { if (i < 10) { date = year_month + "-0" + i; } else { date = year_month + "-" + i; } list.add(date); } return list; } }