Here you can find the source of getLastMonthLastDay()
public static String getLastMonthLastDay()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; public class Main { public final static String YYYY_MM_DD = "yyyy-MM-dd"; public static String getLastMonthLastDay() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); Calendar c = Calendar.getInstance(); c.set(Calendar.DAY_OF_MONTH, 0); return sdf.format(c.getTime()); }// www .j av a 2 s . c om public static String format(Date date, String pattern) { if (date == null) return ""; else return getFormatter(pattern).format(date); } public static String format(Date date) { if (date == null) return ""; else return getFormatter(YYYY_MM_DD).format(date); } private static SimpleDateFormat getFormatter(String parttern) { return new SimpleDateFormat(parttern); } }