Here you can find the source of getMonthStart(Calendar cal)
public static Date getMonthStart(Calendar cal)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getMonthStart(Calendar cal) { cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getActualMinimum(Calendar.DAY_OF_MONTH), 0, 0, 1);//ww w. j a va 2 s . c o m return cal.getTime(); } public static Date getMonthStart(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getActualMinimum(Calendar.DAY_OF_MONTH), 0, 0, 0); return cal.getTime(); } }