Here you can find the source of getLastMonthLastDay()
public static String getLastMonthLastDay()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getLastMonthLastDay() { Calendar cal = Calendar.getInstance(); cal.setTime(cal.getTime());/*from w w w . ja v a 2s .c o m*/ cal.add(Calendar.MONTH, -1); SimpleDateFormat daytime = new SimpleDateFormat("yyyyMMdd"); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); return daytime.format(cal.getTime()); } }