List of usage examples for java.util Calendar get
public int get(int field)
From source file:Main.java
public static String toTimeString(Calendar date) { String hour = "" + date.get(Calendar.HOUR_OF_DAY); String minute = "" + date.get(Calendar.MINUTE); if (minute.length() == 1) minute = "0" + minute; return hour + ":" + minute; }
From source file:Main.java
public static boolean isWeekendDayInCalendar(Calendar calendar) { return calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY; }
From source file:Main.java
private static boolean isYesterDay(Calendar now, Calendar msg) { int nowDay = now.get(Calendar.DAY_OF_YEAR); int msgDay = msg.get(Calendar.DAY_OF_YEAR); return (nowDay - msgDay) == 1; }
From source file:Main.java
private static boolean isTheDayBeforeYesterDay(Calendar now, Calendar msg) { int nowDay = now.get(Calendar.DAY_OF_YEAR); int msgDay = msg.get(Calendar.DAY_OF_YEAR); return (nowDay - msgDay) == 2; }
From source file:Main.java
public static int getYear() { Calendar now = Calendar.getInstance(); return now.get(Calendar.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 getMonth() { Calendar now = Calendar.getInstance(); return now.get(Calendar.MONTH) + 1; }
From source file:Main.java
public static int getDay() { Calendar now = Calendar.getInstance(); return now.get(Calendar.DAY_OF_MONTH); }
From source file:Main.java
public static int getCurrentMin() { Calendar date = Calendar.getInstance(); return date.get(Calendar.MINUTE); }
From source file:Main.java
/** * Check the given date is February 29th. * @param calendar Calendar object to check * @return true if date is February 29th, else false. */// ww w . ja va 2s . co m public static boolean isInsaneDate(Calendar calendar) { return calendar.get(Calendar.DAY_OF_MONTH) == 29 && calendar.get(Calendar.MONTH) == 1; }