Here you can find the source of previousMonthFirstDay()
public static String previousMonthFirstDay()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final String DATE_PATTERN = "yyyy-MM-dd"; public static String previousMonthFirstDay() { SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); Date curDate = new Date(System.currentTimeMillis()); Calendar calendar = Calendar.getInstance(); calendar.setTime(curDate);/*from ww w. j av a 2 s. co m*/ calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); calendar.set(Calendar.DAY_OF_MONTH, 1); return sdf.format(calendar.getTime()); } }