List of utility methods to do Date Set
Date | setMinSeconds(Date date) set Min Seconds Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.SECOND, 0);
return cal.getTime();
|
Date | setMinute(Date date, int minute)Set minute of date object.if (date == null) { return null; Calendar c = getCalendar(date); c.set(Calendar.MINUTE, minute); return c.getTime(); |
Date | setMinutes(Date date, int amount) Sets the minute field to a date returning a new object. return set(date, Calendar.MINUTE, amount);
|
Date | setStartDateIfNull(java.util.Date start) set Start Date If Null Date result = start; if (start == null) { Calendar calendar = Calendar.getInstance(); calendar.set(2013, Calendar.FEBRUARY, 1); result = calendar.getTime(); return result; |
Date | setStartDay(Date date) set Start Day Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 00);
calendar.set(Calendar.MINUTE, 00);
calendar.set(Calendar.SECOND, 00);
return calendar.getTime();
|
Date | setStartTime(Date date) set Start Time Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
|
Date | setTime(Date date, int hourOfDay, int minute, int second) set Time Calendar calendar = newCalendar(date);
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
return calendar.getTime();
|
Date | setTime(Date date, int hours, int minutes, int seconds, int millis) set Time Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, hours);
calendar.set(Calendar.MINUTE, minutes);
calendar.set(Calendar.SECOND, seconds);
calendar.set(Calendar.MILLISECOND, millis);
return calendar.getTime();
|
Date | setTime(Date date, String timeString) set Time Calendar cal1 = Calendar.getInstance(); cal1.setTime(date); Calendar cal2 = Calendar.getInstance(); String[] time = timeString.split(":"); cal2.set(cal1.get(Calendar.YEAR), cal1.get(Calendar.MONTH), cal1.get(Calendar.DAY_OF_MONTH), Integer.parseInt(time[0]), Integer.parseInt(time[1]), Integer.parseInt(time[2])); return cal2.getTime(); |
Date | setTime(final Date date, final int hourOfDay, final int minute, final int second) set Time final GregorianCalendar gc = new GregorianCalendar(); gc.setTime(date); gc.set(Calendar.HOUR_OF_DAY, hourOfDay); gc.set(Calendar.MINUTE, minute); gc.set(Calendar.SECOND, second); return gc.getTime(); |