Here you can find the source of getMonth()
public static int getMonth()
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { /**/*from ww w . j ava 2 s. co m*/ * MONTH=2 * */ public static final int MONTH = Calendar.MONTH; public static int getMonth() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.MONTH) + 1; } public static int getMonth(final Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.MONTH) + 1; } }