code: public static Date formatToStartOfDay(final Date date) {
  
      try {
        SimpleDateFormat dateFormat = buildDateFormat(DEFAULT_DATE_SIMPLE_PATTERN);
        String formattedDate = dateFormat.format(date);
        return dateFormat.parse(formattedDate);
      } catch (ParseException pe) {
        throw new DateException("Unparseable date specified.", pe);
      }
    }
docs: Returns the beginning of the given day. <br/>
  e.g: '2012-12-21 21:21:21' => '2012-12-21 00:00:00'
  
  @param date date to be handled.
  @return a new date is beginning of the given day.
  @throws DateException