List of utility methods to do Day Start
Date | startOfDay(Date aDate) start Of Day Calendar cal = GregorianCalendar.getInstance();
cal.setTime(aDate);
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR_OF_DAY, 0);
Date dayBreak = cal.getTime();
return dayBreak;
...
|
Date | startOfDay(Date aDate) Compute day break of the date provided. Calendar cal = GregorianCalendar.getInstance();
cal.setTime(aDate);
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR_OF_DAY, 0);
Date dayBreak = cal.getTime();
return dayBreak;
...
|
Date | startOfDay(Date date) Resettet die Uhrzeit eines Datums. if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date == null ? new Date() : date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); ... |
Date | startOfDay(Date date) Get the first hour, minute, second of the date specified Calendar calendar = CALENDAR; synchronized (calendar) { calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); return calendar.getTime(); ... |
Date | startOfDay(Date dateInst) Method to return a "normalized" version of the input Date whose time is reset to the absolute start of that same day (first millisecond of first second of first minute of first hour). if (dateInst == null) { throw new IllegalArgumentException(); final Calendar cal = new GregorianCalendar(); cal.setTime(dateInst); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); ... |
Date | startOfDay(Date inDate, TimeZone timeZone) Calculate the start of day date time (i.e. GregorianCalendar c1 = new GregorianCalendar(); c1.setTimeZone(timeZone); c1.setTime(inDate); GregorianCalendar c2 = new GregorianCalendar(c1.get(Calendar.YEAR), c1.get(Calendar.MONTH), c1.get(Calendar.DATE)); c2.setTimeZone(timeZone); return c2.getTime(); |
Date | startOfDay(Date value) Return the start of a day containing a specified time Calendar working = new GregorianCalendar(); working.setTime(value); working.set(Calendar.HOUR_OF_DAY, 0); working.set(Calendar.MINUTE, 0); working.set(Calendar.SECOND, 0); working.set(Calendar.MILLISECOND, 0); return working.getTime(); |
Calendar | startOfDay(final Date date) start Of Day Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
setStartOfDay(calendar);
return calendar;
|
Date | startOfDay(final Date date) start Of Day final GregorianCalendar dateCalendar = new GregorianCalendar(); dateCalendar.setTime(date); return new GregorianCalendar(dateCalendar.get(YEAR), dateCalendar.get(MONTH), dateCalendar.get(DAY_OF_MONTH)).getTime(); |
long | startOfDayInMillis(long date) Returns day in millis with the hours, milliseconds, seconds and minutes set to 0. Calendar calendar = Calendar.getInstance(); synchronized (calendar) { calendar.setTimeInMillis(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); return calendar.getTimeInMillis(); ... |