Here you can find the source of getMonth(Date date)
public static int getMonth(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static int getMonth(Date date) { if (null == date) { throw new IllegalArgumentException("The date is null"); }/* w w w . j a va2 s .com*/ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.MONTH); } }