public static Date startOfDay(Date dateInst){
  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);
  cal.set(Calendar.MILLISECOND,0);
  return cal.getTime();
}

public static Date startOfDay ( Date dateInst ) { 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 ) ; cal . set ( Calendar . MILLISECOND , 0 ) ; return cal . getTime ( ) ; }
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 ) .
