Example usage for java.util Calendar MONTH

List of usage examples for java.util Calendar MONTH

Introduction

In this page you can find the example usage for java.util Calendar MONTH.

Prototype

int MONTH

To view the source code for java.util Calendar MONTH.

Click Source Link

Document

Field number for get and set indicating the month.

Usage

From source file:Main.java

public static int getMonth(Calendar c) {
    return c.get(Calendar.MONTH);
}

From source file:Main.java

public static int getMonth() {
    return Calendar.getInstance().get(Calendar.MONTH) + 1;
}

From source file:Main.java

public static int getMonth() {
    return Calendar.getInstance().get(Calendar.MONTH);
}

From source file:Main.java

public static int getCurMonth() {
    return Calendar.getInstance().get(Calendar.MONTH) + 1;
}

From source file:Main.java

public static Calendar setNextMonth(Calendar calendar) {
    calendar.add(Calendar.MONTH, 1);
    return calendar;
}

From source file:Main.java

public static Calendar setPrevMonth(Calendar calendar) {
    calendar.add(Calendar.MONTH, -1);
    return calendar;
}

From source file:Main.java

public static int getCurrentMonth() {
    return Calendar.getInstance().get(Calendar.MONTH);

}

From source file:Main.java

public static int numDayOfMonth(Calendar calendar) {
    return calendar.getActualMaximum(Calendar.MONTH);
}

From source file:Main.java

public static Calendar addMonths(long time, int months) {
    return add(time, months, Calendar.MONTH);
}

From source file:Main.java

public static Calendar getLastFriday(Calendar cal, int offset) {
    int dayofweek;
    cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + offset);
    cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    dayofweek = cal.get(Calendar.DAY_OF_WEEK);
    if (dayofweek < Calendar.FRIDAY)
        cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 7 + Calendar.FRIDAY - dayofweek);
    else/*ww w. java  2  s  .c om*/
        cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) + Calendar.FRIDAY - dayofweek);

    return cal;
}