Java Month Get getMonth(Date date)

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

Description

get Month

License

Apache License

Declaration

public static int getMonth(Date date) 

Method Source Code

//package com.java2s;
/**//w ww.j av a 2  s.  com
  *  Copyright (c) 2014 http://www.lushapp.wang
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  */

import java.util.*;

public class Main {
    public static int getMonth(Date date) {
        return getDatePar(Calendar.MONTH, date);
    }

    public static int getDatePar(int par, Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int result = calendar.get(par);
        switch (par) {
        case Calendar.MONTH:
            result++;
        }
        return result;
    }
}

Related

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