Android Calendar Get getCurrentMonth()

Here you can find the source of getCurrentMonth()

Description

get Current Month

Declaration

public static int getCurrentMonth() 

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;
    }/* ww  w .ja  va 2 s . co  m*/

    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. GetCurrentTime_String()
  2. GetCurrentTime_UTCMilliSeconds()
  3. GetCurrentTime_UTCSeconds()
  4. getCurrentTimeStr()
  5. getCurrentWeek()
  6. getCurrentWeek()
  7. getCurrentWeek(Calendar cal)