Here you can find the source of firstDayOfMonth(Date date)
public static Date firstDayOfMonth(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date firstDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w ww . j a v a 2s . c o m cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance() .getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.HOUR_OF_DAY, Calendar.getInstance() .getActualMinimum(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, Calendar.getInstance().getActualMinimum(Calendar.MINUTE)); return cal.getTime(); } }