You can use java calendar to obtain all the days of a month in a certain year, and then cycle
Reprinted please indicate the source: java loop all days of a month in a year
Package com. zuidaima. date; import java. text. parseException; import java. util. calendar; public class LoopDayOfMonth {public static void main (String [] args) throws ParseException {Calendar calendar = Calendar. getInstance (); int year = 2009; int month = Calendar ar. FEBRUARY; int date = 1; calendar. set (year, month, date); int maxDay = calendar ar. getActualMaximum (Calendar. DAY_OF_MONTH); System. out. println ("Max Day:" + maxDay); int minDay = calendar. getActualMinimum (Calendar. DAY_OF_MONTH); System. out. println ("Min Day:" + minDay); for (int I = minDay; I <= maxDay; I ++) {calendar. set (year, month, I); System. out. println ("Day:" + calendar. getTime (). toLocaleString ());}}}
Full: http://www.zuidaima.com/share/1550463248108544.htm