Here you can find the source of getMonth1D()
public static Date getMonth1D()
//package com.java2s; /**/*from w w w . j a v a2 s . co m*/ * Copyright (c) 2014 http://www.lushapp.wang * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.*; public class Main { public static Date getMonth1D() { return getMonth1D(new Date()); } public static Date getMonth1D(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); return calendar.getTime(); } }