Java Date to Month month(Date inDate, TimeZone timeZone)

Here you can find the source of month(Date inDate, TimeZone timeZone)

Description

Calcuate the month number (0 - 11) for the given date.

License

Open Source License

Parameter

Parameter Description
inDate The given date.

Return

The month number.

Declaration

public static int month(Date inDate, TimeZone timeZone) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;

import java.util.TimeZone;

public class Main {
    /**/*from w w  w.  j  a v  a 2 s . c  om*/
     * Calcuate the month number (0 - 11) for the given date.
     * 
     * @param inDate The given date.
     * @return The month number.
     */
    public static int month(Date inDate, TimeZone timeZone) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeZone(timeZone);
        calendar.setTime(inDate);

        return calendar.get(Calendar.MONTH);
    }
}

Related

  1. getNextMonthFirstDate(Date date)
  2. getNextMonthFirstDay(Date date)
  3. getNextMonthPreviousDay(Date date, int month_num)
  4. getNextMonthsByStartDate(Date date, int month)
  5. month(Date date)
  6. month(final Date date)
  7. monthBegin(final Date date)
  8. monthOf(Date date)