Here you can find the source of getMonth(Date date, TimeZone timeZone)
public static int getMonth(Date date, TimeZone timeZone)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static final SimpleDateFormat _fmtMonth = new SimpleDateFormat("MM"); public static int getMonth(Date date, TimeZone timeZone) { if (date == null) throw new IllegalArgumentException("date is required."); if (timeZone == null) timeZone = TimeZone.getDefault(); _fmtMonth.setTimeZone(timeZone); try {// ww w . ja v a 2 s. c om return Integer.parseInt(_fmtMonth.format(date)); } catch (NumberFormatException e) { throw new IllegalStateException("Failed to format date : " + e.getMessage()); } } }