Android Month Date Get getCurrentMonth(Date date)

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

Description

get Current Month

Declaration

public static int getCurrentMonth(Date date) 

Method Source Code

//package com.java2s;

import java.sql.Timestamp;

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

public class Main {
    public static int getCurrentMonth() {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(new Date());
        return calendar.get(Calendar.MONTH) + 1;
    }//w w  w  .j a v  a2  s. c  om

    public static int getCurrentMonth(Timestamp t1) {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(t1);
        return calendar.get(Calendar.MONTH) + 1;
    }

    public static int getCurrentMonth(Date date) {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        return calendar.get(Calendar.MONTH) + 1;
    }
}

Related

  1. monthNumber(Date date)
  2. maxMonthDate(Date date)
  3. getMonthStartDate(Date date)
  4. getMonthEndDate(Date date)