Example usage for java.util Calendar getInstance

List of usage examples for java.util Calendar getInstance

Introduction

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

Prototype

public static Calendar getInstance() 

Source Link

Document

Gets a calendar using the default time zone and locale.

Usage

From source file:Main.java

public static boolean isWeekend() {
    Calendar now = Calendar.getInstance();
    return (now.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
            || (now.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY);
}

From source file:Main.java

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

}

From source file:Main.java

public static int GetMonth() {
    Calendar now = Calendar.getInstance();
    return now.get(Calendar.MONTH);

}

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 int currentDay() {
    Calendar c = Calendar.getInstance();
    int day = c.get(Calendar.DATE);
    return day;//w w w . ja  v a 2s .  c  om
}

From source file:Main.java

public static int getWeekOfYear() {
    Calendar now = Calendar.getInstance();
    return now.get(Calendar.WEEK_OF_YEAR);
}

From source file:Main.java

public static int getWeekDay() {
    Calendar date = Calendar.getInstance();
    return date.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY;
}

From source file:Main.java

public static int currentMonth() {
    Calendar c = Calendar.getInstance();
    int month = c.get(Calendar.MONTH) + 1;
    return month;
}

From source file:Main.java

private static int getTimeByType(int type) {
    return Calendar.getInstance().get(type);
}

From source file:Main.java

public static int getDay() {
    Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.DAY_OF_MONTH);
}