Java Month Get getMonth(Date date)

Here you can find the source of getMonth(Date date)

Description

get Month

License

Apache License

Parameter

Parameter Description
date Date

Return

int month number 0-based

Declaration

public static int getMonth(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**//  w  w  w.jav  a 2 s.  c o m
     * @param date Date
     * @return int month number 0-based
     */
    public static int getMonth(Date date) {
        GregorianCalendar calendar = (GregorianCalendar) GregorianCalendar.getInstance();
        long time = date.getTime();
        calendar.setTimeInMillis(time);
        return calendar.get(calendar.MONTH);
    }
}

Related

  1. getMonth(Date date)
  2. getMonth(Date date)
  3. getMonth(Date date)
  4. getMonth(Date date)
  5. getMonth(Date date)
  6. getMonth(Date date)
  7. getMonth(Date date)
  8. getMonth(Date date)
  9. getMonth(Date date, TimeZone timeZone)