public static Date[] constructDateRange(final Date fromDate,final Date toDate){
  final Date[] dates=new Date[2];
  final Calendar calfrom=Calendar.getInstance();
  calfrom.setTime(fromDate);
  calfrom.set(Calendar.HOUR,0);
  calfrom.set(Calendar.MINUTE,0);
  calfrom.set(Calendar.SECOND,0);
  calfrom.set(Calendar.AM_PM,Calendar.AM);
  dates[0]=calfrom.getTime();
  final Calendar calto=Calendar.getInstance();
  calto.setTime(toDate);
  calto.set(Calendar.HOUR,0);
  calto.set(Calendar.MINUTE,0);
  calto.set(Calendar.SECOND,0);
  calto.add(Calendar.DAY_OF_MONTH,1);
  dates[1]=calto.getTime();
  return dates;
}

public static Date [ ] constructDateRange ( final Date fromDate , final Date toDate ) { final Date [ ] dates = new Date [ 2 ] ; final Calendar calfrom = Calendar . getInstance ( ) ; calfrom . setTime ( fromDate ) ; calfrom . set ( Calendar . HOUR , 0 ) ; calfrom . set ( Calendar . MINUTE , 0 ) ; calfrom . set ( Calendar . SECOND , 0 ) ; calfrom . set ( Calendar . AM_PM , Calendar . AM ) ; dates [ 0 ] = calfrom . getTime ( ) ; final Calendar calto = Calendar . getInstance ( ) ; calto . setTime ( toDate ) ; calto . set ( Calendar . HOUR , 0 ) ; calto . set ( Calendar . MINUTE , 0 ) ; calto . set ( Calendar . SECOND , 0 ) ; calto . add ( Calendar . DAY_OF_MONTH , 1 ) ; dates [ 1 ] = calto . getTime ( ) ; return dates ; }
constructs the date range for the given from date and to date the given dates will change like following < br / > from date will construct time as 0 : 0 : 0 am < br / > to date will construct time as to date + 1 [ one day advance ] 0 : 0 : 0 .
