Java Date to Month getMonth(Date date)

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

Description

get Month

License

Apache License

Declaration

public static Integer getMonth(Date date) 

Method Source Code


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

import static java.util.Calendar.*;

import java.util.*;

public class Main {
    public static Integer getMonth(Date date) {
        if (date == null) {
            return null;
        }/*from   w w  w.j  a  v a 2  s.  c  o m*/

        Calendar ca = Calendar.getInstance();
        ca.setTime(date);
        return Integer.valueOf(ca.get(MONTH) + 1);
    }
}

Related

  1. getMonth(Date aDate)
  2. getMonth(Date d)
  3. getMonth(Date d)
  4. getMonth(Date d)
  5. getMonth(Date d)
  6. getMonth(Date date)
  7. getMonth(Date date)
  8. getMonth(Date date)
  9. getMonth(Date date)