Java Date to Month getMonth(Date date)

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

Description

get Month

License

Apache License

Parameter

Parameter Description
date a parameter

Return

int

Declaration

public static int getMonth(Date date) 

Method Source Code

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

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

public class Main {

    public static int getMonth(Date date) {
        Calendar cld = Calendar.getInstance();
        cld.setTime(date);/*from   w  w w .j  a  va2  s  .c o  m*/
        return cld.get(Calendar.MONTH) + 1;
    }
}

Related

  1. getMonth(Date d)
  2. getMonth(Date d)
  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)