Java Month Get getMonthNumber()

Here you can find the source of getMonthNumber()

Description

Get the number of the current month

License

LGPL

Return

The number of the current month

Declaration

public static String getMonthNumber() 

Method Source Code


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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**//  www .  ja v  a  2 s .  c  o m
     * Get the number of the current month
     * @return The number of the current month
     */
    public static String getMonthNumber() {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("MM");
        String output = format.format(date);
        return output;
    }
}

Related

  1. getMonthForInt(int num)
  2. getMonthForString(String monthStr, Locale locale)
  3. getMonthInfo(int monthInfo)
  4. getMonthLength(String countDate)
  5. getMonthNo(Date date)
  6. getMonthOfSeason(Date date, boolean firstOrLast)
  7. getMonthPath(Date date)
  8. getMonthRange(String strBeginDate, String strEndDate, String pattern)
  9. getMonths()