Example usage for java.util Calendar get

List of usage examples for java.util Calendar get

Introduction

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

Prototype

public int get(int field) 

Source Link

Document

Returns the value of the given calendar field.

Usage

From source file:Main.java

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

From source file:Main.java

public static boolean isFridayOrSaturday() {
    Calendar date = new GregorianCalendar();
    return date.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY
            || date.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY;
}

From source file:Main.java

public static void copyTime(Calendar dest, Calendar src) {
    dest.set(Calendar.HOUR_OF_DAY, src.get(Calendar.HOUR_OF_DAY));
    dest.set(Calendar.MINUTE, src.get(Calendar.MINUTE));
    dest.set(Calendar.SECOND, src.get(Calendar.SECOND));
    dest.set(Calendar.MILLISECOND, src.get(Calendar.MILLISECOND));
}

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

public static int getCurrentDayOfWeek() {
    Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.DAY_OF_WEEK);
}

From source file:Main.java

public static int getHourFromDate(Date date) {
    Calendar cal = dateToCalendar(date);
    return cal.get(Calendar.HOUR_OF_DAY);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static int getCurrentYear() {
    Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.YEAR);
}

From source file:Main.java

public static int getCurrentDay() {
    Calendar cal = Calendar.getInstance();
    int day = cal.get(Calendar.DATE);
    return day;//from  www  . j  av  a 2  s.  com
}