public static Date endOfDay(Date dateInst){
  if (dateInst == null) {
    throw new IllegalArgumentException();
  }
  final Calendar cal=new GregorianCalendar();
  cal.setTime(dateInst);
  cal.set(Calendar.HOUR_OF_DAY,LAST_HOUR_OF_DAY);
  cal.set(Calendar.MINUTE,LAST_MINUTE);
  cal.set(Calendar.SECOND,LAST_SECOND);
  cal.set(Calendar.MILLISECOND,LAST_MILLISECOND);
  return cal.getTime();
}

public static Date endOfDay ( Date dateInst ) { if ( dateInst == null ) { throw new IllegalArgumentException ( ) ; } final Calendar cal = new GregorianCalendar ( ) ; cal . setTime ( dateInst ) ; cal . set ( Calendar . HOUR_OF_DAY , LAST_HOUR_OF_DAY ) ; cal . set ( Calendar . MINUTE , LAST_MINUTE ) ; cal . set ( Calendar . SECOND , LAST_SECOND ) ; cal . set ( Calendar . MILLISECOND , LAST_MILLISECOND ) ; return cal . getTime ( ) ; }
method to return an " anti - normalized " version of the input date whose time is set to the absolute end of that same day ( last millisecond of last second of last minute of last hour ) .
