Here you can find the source of getFirstDateOfCurMonth()
public static String getFirstDateOfCurMonth()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String date_pattern = "yyyy-MM-dd"; public static String getFirstDateOfCurMonth() { String curYearMonth = getCurYearMonth(); return curYearMonth + "-01"; }/*from w w w . ja va 2s . c om*/ public static String getCurYearMonth() { String curTime = getCurDate(); String curYearMonth = curTime.substring(0, 7); return curYearMonth; } public static String getCurDate() { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat(date_pattern); return format.format(date); } public static String getCurDate(String fmt) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat(fmt); return format.format(date); } }