Here you can find the source of getLastdayofMonth()
public static String getLastdayofMonth()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**//from w w w . j a v a 2 s. co m * @Title: getLastdayofMonth * @Description: TODO * @author alterhu2020@gmail.com * @param @return * @return String return type * @throws */ public static String getLastdayofMonth() { Calendar c = Calendar.getInstance(); int totalday = c.getActualMaximum(Calendar.DAY_OF_MONTH); c.set(Calendar.DAY_OF_MONTH, totalday); System.out.println(c.getTime()); return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); } }