Java Month Get getMonth(Integer month)

Here you can find the source of getMonth(Integer month)

Description

Gets Name of the month by its number

License

Open Source License

Parameter

Parameter Description
month month number, starting 0

Return

number of month in a year starting 0

Declaration

public static String getMonth(Integer month) 

Method Source Code

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

import java.text.DateFormatSymbols;

import java.util.*;

public class Main {
    /**/*w  w w. j ava2s. c  o  m*/
     * Gets Name of the month by its number
     *
     * @param month month number, starting 0
     * @return number of month in a year starting 0
     */
    public static String getMonth(Integer month) {
        return new DateFormatSymbols().getMonths()[month];
    }

    /**
     * Returns month number starting 0
     *
     * @param month month name, e.g. November
     * @return number of month in a year starting 0
     */
    public static Integer getMonth(String month) {
        return Arrays.asList(new DateFormatSymbols().getMonths()).indexOf(month);
    }
}

Related

  1. getMonth(Date theDate)
  2. getMonth(int i)
  3. getMonth(int i)
  4. getMonth(int month)
  5. getMonth(int month)
  6. getMonth(long date, int increment)
  7. getMonth(long l)
  8. getMonth(SimpleDateFormat df, String dateStr)
  9. getMonth(String aDate)