public static Date trimDate( Date date ) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime( date );
    calendar.set( Calendar.MILLISECOND, 0 );
    calendar.set( Calendar.SECOND, 0 );
    calendar.set( Calendar.MINUTE, 0 );
    calendar.set( Calendar.HOUR_OF_DAY, 0 );
    return calendar.getTime();
  }
@Test
  public void testTrimDate() {
    Date now = new Date();
    Date nowTrimed = Const.trimDate( now );
    Calendar calendar = GregorianCalendar.getInstance();
    calendar.setTime( nowTrimed  );
    assertEquals( 0, calendar.get( Calendar.HOUR_OF_DAY ) );
    assertEquals( 0, calendar.get( Calendar.MINUTE ) );
    assertEquals( 0, calendar.get( Calendar.SECOND ) );
    assertEquals( 0, calendar.get( Calendar.MILLISECOND ) );
  }