Here you can find the source of getMonthLastDay()
public static String getMonthLastDay()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getMonthLastDay() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); return convertDate(calendar.getTimeInMillis()); }// w ww . java 2 s .c om public static String convertDate(long timestamp) { return new SimpleDateFormat("yyyy-MM-dd").format(new Date(timestamp)); } public static String format(Date date) { return format(date, "yyyy-MM-dd HH:mm:ss"); } public static String format(Date date, String pattern) { return new SimpleDateFormat(pattern).format(date); } }