Java Date to Month getMonthOfThisYear(Date currentdate)

Here you can find the source of getMonthOfThisYear(Date currentdate)

Description

get Month Of This Year

License

Apache License

Declaration

public static int getMonthOfThisYear(Date currentdate) 

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 getMonthOfThisYear(Date currentdate) {
        Calendar cal = Calendar.getInstance();
        if (currentdate != null) {
            cal.setTime(currentdate);/* ww  w  .  j  ava  2 s  .c o  m*/
        } else {
            cal.setTime(new Date());
        }
        return cal.get(Calendar.MONTH) + 1;
    }
}

Related

  1. getMonthLastDay(Date date)
  2. getMonthlyKey(Date d)
  3. getMonthName(Date date)
  4. getMonthOfCurrentTime(Date date)
  5. getMonthOffset(Date sourceDate, Date targetDate)
  6. getMonthOfYear(Date date)
  7. getMonthOfYear(Date dt)
  8. getMonthOfYear(final Date date)
  9. getMonthRate(Date date, boolean moveIn)