List of usage examples for java.util Calendar HOUR_OF_DAY
int HOUR_OF_DAY
To view the source code for java.util Calendar HOUR_OF_DAY.
Click Source Link
get
and set
indicating the hour of the day. From source file:Main.java
public static long getDayStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0);/*from ww w. ja va 2s . co m*/ cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static long getTimesStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0);// w ww . j a va2s.c om cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static long getTimesNextStart() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 24); cal.set(Calendar.SECOND, 0);//from w w w. j a v a 2s . co m cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
private static long getTodayZeroTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.SECOND, 0);/* w w w . j ava 2 s . co m*/ cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static int getHour() { return getCalendar(getCurrentDate()).get(Calendar.HOUR_OF_DAY); }
From source file:Main.java
private static long getYesterdayZeroTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, -24); cal.set(Calendar.SECOND, 0);//from ww w. j a v a 2 s . c o m cal.set(Calendar.MINUTE, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static boolean isDay() { Calendar calendar = Calendar.getInstance(); int time = calendar.get(Calendar.HOUR_OF_DAY); return time >= 6 && time < 18; }
From source file:Main.java
public static boolean isNowBeforeSixAM() { Calendar today = Calendar.getInstance(); return ((today.get(Calendar.HOUR_OF_DAY) < 6 && (today.get(Calendar.HOUR_OF_DAY) >= 0) ? true : false)); }
From source file:Main.java
public static int getCurrentTimeStamp() { Calendar now = Calendar.getInstance(); int hour = now.get(Calendar.HOUR_OF_DAY); int minute = now.get(Calendar.MINUTE); return 60 * hour + minute; }
From source file:Main.java
public static boolean isDisturbTime(Calendar c) { int hours = c.get(Calendar.HOUR_OF_DAY); return hours >= 23 | hours < 6; }