Here you can find the source of getFirstDayStrOfMonth(Date date)
public static String getFirstDayStrOfMonth(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getFirstDayStrOfMonth(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from ww w . jav a 2 s . c o m*/ calendar.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); return formatDate2Str(calendar.getTime()); } public static String formatDate2Str(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(date); } }