Here you can find the source of getStartOfMonth(Date date)
public static Date getStartOfMonth(Date date)
//package com.java2s; /**//from w w w . jav a 2 s .c o m * Tern Framework. * * @author fancimage * @Copyright 2010 qiao_xf@163.com Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ import java.util.Date; public class Main { public static Date getStartOfMonth(Date date) { java.util.Calendar cal = java.util.Calendar.getInstance(); cal.setTime(date); cal.set(java.util.Calendar.DATE, 1); return cal.getTime(); } }