code: public static long roundToDay(final long pTime, final TimeZone pTimeZone) {
          int offset = pTimeZone.getOffset(pTime);
          return (((pTime  + offset) / DAY) * DAY) - offset;
      }
docs: Rounds the given time down to the closest day, using the given timezone.
  
  @param pTime time
  @param pTimeZone the timezone to use when rounding
  @return the time rounded to the closest day.