Here you can find the source of getThisMonth(int year, int monthIndex)
public static Calendar getThisMonth(int year, int monthIndex)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static Calendar getThisMonth(int year, int monthIndex) { Calendar thisMonth = Calendar.getInstance(); if (year > 1900) thisMonth.set(Calendar.YEAR, year); else/*from ww w. j a v a 2 s. com*/ thisMonth.set(Calendar.YEAR, 1901); if (monthIndex >= 0 && monthIndex < 12) thisMonth.set(Calendar.MONTH, monthIndex); else thisMonth.set(Calendar.MONTH, 0); thisMonth.setFirstDayOfWeek(Calendar.SUNDAY); thisMonth.set(Calendar.DAY_OF_MONTH, 1); return thisMonth; } }