Here you can find the source of getFirstDayOfMonth(int year, int month)
public static String getFirstDayOfMonth(int year, int month)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getFirstDayOfMonth(int year, int month) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DATE)); return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); }/* w w w. j a v a2s. c o m*/ }