public static Date removeTimeFromDate( Date input ) {
    if ( input == null ) {
      return null;
    }
    // Get an instance of the Calendar.
    Calendar calendar = Calendar.getInstance();

    // Make sure the calendar will not perform automatic correction.
    calendar.setLenient( false );

    // Set the time of the calendar to the given date.
    calendar.setTime( input );

    // Remove the hours, minutes, seconds and milliseconds.
    calendar.set( Calendar.HOUR_OF_DAY, 0 );
    calendar.set( Calendar.MINUTE, 0 );
    calendar.set( Calendar.SECOND, 0 );
    calendar.set( Calendar.MILLISECOND, 0 );

    // Return the date again.
    return calendar.getTime();
  }
@Test
  public void testRemoveTimeFromDate() {
    final Date date = Const.removeTimeFromDate( new Date() );
    assertEquals( 0, date.getHours() );
    assertEquals( 0, date.getMinutes() );
    assertEquals( 0, date.getSeconds() );
  }