Here you can find the source of getMonth(Date date)
public static int getMonth(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static int getMonth(Date date) { Calendar calendar = getCalendarFromDate(date); return calendar.get(Calendar.MONTH) + 1; }/*from www.ja v a 2 s .com*/ /** * get calendar from date * * @param date the passing date * @return the calendar instance */ public static Calendar getCalendarFromDate(Date date) { Calendar calendar = getDefaultCalendar(); calendar.setTime(date); return calendar; } /** * get the default calendar * * @return the calendar instance */ public static Calendar getDefaultCalendar() { Calendar calendar = Calendar.getInstance(); calendar.setFirstDayOfWeek(Calendar.MONDAY); return calendar; } }