Here you can find the source of getMonth(Date date)
public static int getMonth(Date date)
//package com.java2s; /**//w ww.j av a 2 s. com * Copyright (c) 2014 http://www.lushapp.wang * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.*; public class Main { public static int getMonth(Date date) { return getDatePar(Calendar.MONTH, date); } public static int getDatePar(int par, Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int result = calendar.get(par); switch (par) { case Calendar.MONTH: result++; } return result; } }