Here you can find the source of getPreviousMonthFirst(Date appointDate)
public static Date getPreviousMonthFirst(Date appointDate)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getPreviousMonthFirst(Date appointDate) { Calendar appointCalendar = Calendar.getInstance(); appointCalendar.setTime(appointDate); Calendar lastDate = Calendar.getInstance(); lastDate.set(Calendar.DATE, 1);// lastDate.set(Calendar.MONTH, appointCalendar.get(Calendar.MONTH) - 1); lastDate.set(Calendar.YEAR, appointCalendar.get(Calendar.YEAR)); return lastDate.getTime(); }/* w w w .j a v a 2 s . c o m*/ }