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 Calendar getDate(Calendar calendar) { Calendar cal = (Calendar) calendar.clone(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);//from w ww. ja va 2s .c om cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }
From source file:Main.java
public static long getTimeMillisAt(int hour, int minute) { Calendar today = Calendar.getInstance(); today.set(Calendar.HOUR_OF_DAY, hour); today.set(Calendar.MINUTE, minute); return today.getTimeInMillis(); }
From source file:Main.java
private static Calendar getTodayAutoPushTime() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 10); calendar.set(Calendar.MINUTE, 0); return calendar; }
From source file:Main.java
public static boolean isWorkTime() { Calendar calendar = Calendar.getInstance(); int hour = calendar.get(Calendar.HOUR_OF_DAY); if (hour < 9 || hour > 19) { return false; }//from ww w . java 2 s. co m return true; }
From source file:Main.java
public static boolean isDayOrNight() { Calendar calendar = Calendar.getInstance(); int hour = calendar.get(Calendar.HOUR_OF_DAY); if (hour >= 0 && hour < 18) return true; else// ww w . j a va 2 s . c om return false; }
From source file:Main.java
static public Calendar getTimeFromInt(int hourOfDay, int minute) { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, hourOfDay); c.set(Calendar.MINUTE, minute); return c;/* w ww . ja v a 2 s .c o m*/ }
From source file:Main.java
public static Calendar getMorningCal(int hour, int minute) { Calendar c = Calendar.getInstance(); if (c.get(Calendar.HOUR_OF_DAY) > 3) { //next day c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + 1); }/* ww w .j av a 2s. c o m*/ c.set(Calendar.HOUR_OF_DAY, hour); c.set(Calendar.MINUTE, minute); c.set(Calendar.SECOND, 0); return c; }
From source file:Main.java
public static void clearTimeInfo(Calendar theDate) { if (theDate == null) { return;//from w w w .j av a 2 s . co m } theDate.set(Calendar.HOUR_OF_DAY, 0); theDate.set(Calendar.MINUTE, 0); theDate.set(Calendar.SECOND, 0); }
From source file:Main.java
public static String getStringTime() { Calendar c = Calendar.getInstance(Locale.ITALY); return c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE) + ":" + c.get(Calendar.SECOND); }
From source file:Main.java
public static Calendar getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); // locale-specific cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);/*from w w w . j a v a2s . com*/ cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }