Here you can find the source of getMonthStartTimestamp(Date date)
public static Timestamp getMonthStartTimestamp(Date date)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Timestamp getMonthStartTimestamp(Date date) { Date start = getMonthStartDate(date); return new Timestamp(start.getTime()); }// www . j a va 2 s. c o m public static Date getMonthStartDate(Date date) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } }