Here you can find the source of getLastDayOfLastMonth()
public static String getLastDayOfLastMonth()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getLastDayOfLastMonth() { SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.DAY_OF_MONTH, 1); cal.add(Calendar.DAY_OF_MONTH, -1); return format.format(cal.getTime()); }//w w w. j a v a2s .co m }