Here you can find the source of getFirstDayOfMonth(Date date)
@SuppressWarnings("deprecation") public static Date getFirstDayOfMonth(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { @SuppressWarnings("deprecation") public static Date getFirstDayOfMonth(Date date) { Calendar result = Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, date.getYear() + 1900); calendar.set(Calendar.MONTH, date.getMonth()); calendar.set(Calendar.DATE, date.getDate()); result.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DATE)); result.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); result.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); return result.getTime(); }//from w ww . j a v a 2 s . c o m }