Here you can find the source of getMonthStart(Date date)
public static Date getMonthStart(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getMonthStart(Date date) { if (date == null) { return null; }/*from ww w . j a v a 2s . c o m*/ Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } public static long getTime(Date date) { return date.getTime(); } }