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 toBeginningOfDay(Calendar day) { day.set(Calendar.HOUR_OF_DAY, 0); day.set(Calendar.MINUTE, 0);/*from w w w . ja v a 2 s. c om*/ day.set(Calendar.SECOND, 0); day.set(Calendar.MILLISECOND, 0); return day; }
From source file:Main.java
private static void removeTimeFromCalendar(Calendar cal) { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);/* w w w . j av a 2 s . co m*/ cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); }
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 Calendar setEndOfDate(Calendar calendar) { calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); return calendar; }
From source file:Main.java
public static Calendar clearTime(Calendar calendar) { calendar.clear(Calendar.HOUR_OF_DAY); calendar.clear(Calendar.HOUR); calendar.clear(Calendar.MINUTE); calendar.clear(Calendar.SECOND); calendar.clear(Calendar.MILLISECOND); return calendar; }
From source file:Main.java
public static Calendar clearTime(Calendar calendar) { calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar; }
From source file:Main.java
public static Calendar addHours(long time, int hours) { return add(time, hours, Calendar.HOUR_OF_DAY); }
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 long today9am() { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 9); c.set(Calendar.MINUTE, 0);//from ww w . jav a2 s. com c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTimeInMillis(); }
From source file:Main.java
public static long getTimesEnd() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTimeInMillis(); }