Here you can find the source of currentMonthFirstDay()
public static String currentMonthFirstDay()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final String DATE_PATTERN = "yyyy-MM-dd"; public static String currentMonthFirstDay() { SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); Date curDate = new Date(System.currentTimeMillis()); Calendar calendar = Calendar.getInstance(); calendar.setTime(curDate);//ww w . j av a 2 s .c om calendar.set(Calendar.DAY_OF_MONTH, 1); return sdf.format(calendar.getTime()); } }