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 String formatNoaaForCalendar(Calendar c) {
    return "" + c.get(Calendar.YEAR) + "-" + String.format("%02d", (c.get(Calendar.MONTH) + 1)) + "-"
            + String.format("%02d", c.get(Calendar.DATE));
}

From source file:Main.java

public static String getCurrentData() {
    Calendar c = Calendar.getInstance();
    return "" + c.get(Calendar.YEAR) + c.get(Calendar.MONTH) + c.get(Calendar.DAY_OF_MONTH);
}

From source file:Main.java

public static String toDateString(Calendar date) {
    int day = date.get(Calendar.DAY_OF_MONTH);
    int month = date.get(Calendar.MONTH);
    int year = date.get(Calendar.YEAR);
    return day + "/" + (month + 1) + "/" + year;
}

From source file:Main.java

public static boolean isNationalDay() {
    Calendar calendar = Calendar.getInstance();
    int month = calendar.get(Calendar.MONTH) + 1;
    int day = calendar.get(Calendar.DAY_OF_MONTH);
    if (month == 10 && day <= 7) {
        return true;
    }//from  w  w w. ja v  a2  s .  c o m
    return false;
}

From source file:Main.java

public static String getPhoneMonth() {
    return "" + (calendar.get(Calendar.MONTH) + 1);
}

From source file:Main.java

private static Boolean isThisMonth(Calendar calendar) {
    Calendar nowCalendar = Calendar.getInstance();
    return calendar.get(Calendar.MONTH) == nowCalendar.get(Calendar.MONTH);
}

From source file:Main.java

public static long getTimesMonthStart() {
    Calendar cal = Calendar.getInstance();
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
    cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
    return cal.getTimeInMillis();
}

From source file:Main.java

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

From source file:Main.java

public static long getTimesMonthNextStart() {
    Calendar cal = Calendar.getInstance();
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
    cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    cal.set(Calendar.HOUR_OF_DAY, 24);
    return cal.getTimeInMillis();
}

From source file:Main.java

public static String getTodaysDate() {
    Calendar c = Calendar.getInstance();
    return c.get(Calendar.YEAR) + "-0" + String.valueOf(c.get(Calendar.MONTH) + 1) + "-"
            + c.get(Calendar.DAY_OF_MONTH);
}