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.
7344
public static long roundToDay(final long pTime, final TimeZone pTimeZone) {
        int offset = pTimeZone.getOffset(pTime);
        return (((pTime  + offset) / DAY) * DAY) - offset;
    }
1218829
public static LocalDateTime toDate(Day day, Time time)
   {

      time.assignDate(LocalDateTime.of(day.getLocalDate(),
      time.getLocalDateTime().toLocalTime()));
      
      return time.getLocalDateTime();
   }
564833
def in_timezone(self, tz):  # type: (Union[str, Timezone]) -> DateTime
        
        tz = pendulum._safe_timezone(tz)

        return tz.convert(self, dst_rule=pendulum.POST_TRANSITION)
260784
def round_to_specified_time(self, a_datetime, hour, minute, second, mode="lower"):
        
        mode = mode.lower()
        
        new_datetime = datetime(a_datetime.year, a_datetime.month, a_datetime.day,
                                hour, minute, second)
        if mode == "lower": 
            if new_datetime <= a_datetime:
                return new_datetime
            else:
                return timewrapper.add_days(new_datetime, -1)
        elif mode == "upper":
            if new_datetime >= a_datetime:
                return new_datetime
            else:
                return timewrapper.add_days(new_datetime, 1)
        else:
            raise ValueError("'mode' has to be lower or upper!")
29778
public void setTimeZone(final TimeZone timezone) {
        if (dates == null) {
            throw new UnsupportedOperationException(
                    "TimeZone is not applicable to current value");
        }
        this.timeZone = timezone;
        if (timezone != null) {
            if (!Value.DATE_TIME.equals(getDates().getType())) {
                throw new UnsupportedOperationException(
                        "TimeZone is not applicable to current value");
            }
            dates.setTimeZone(timezone);
            getParameters().remove(getParameter(Parameter.TZID));
            final TzId tzId = new TzId(timezone.getID());
            getParameters().replace(tzId);
        } else {
            // use setUtc() to reset timezone..
            setUtc(false);
        }
    }
455236
public static java.util.TimeZone wrap(android.icu.util.TimeZone tz) {
        return new TimeZoneAdapter(tz);
    }
507770
public static long round(final long time, final int precision, final TimeZone tz) {
        if ((precision == PRECISION_SECOND) && ((time % Dates.MILLIS_PER_SECOND) == 0)) {
            return time;
        }
        final Calendar cal = Calendar.getInstance(tz);
        cal.setTimeInMillis(time);
        if (precision == PRECISION_DAY) {
//            return (long) Math.floor(time / (double) Dates.MILLIS_PER_DAY) * Dates.MILLIS_PER_DAY;
            cal.set(Calendar.HOUR_OF_DAY, 0);
            cal.clear(Calendar.MINUTE);
            cal.clear(Calendar.SECOND);
            cal.clear(Calendar.MILLISECOND);
        }
        else if (precision == PRECISION_SECOND) {
//            return (long) Math.floor(time / (double) Dates.MILLIS_PER_SECOND) * Dates.MILLIS_PER_SECOND;
            cal.clear(Calendar.MILLISECOND);
        }
        // unrecognised precision..
        return cal.getTimeInMillis();
    }
617674
public String format(Time pTime) {
	StringBuilder buf = new StringBuilder();
	for (int i = 0; i < formatter.length; i++) {
	    buf.append(formatter[i].format(pTime));
	}
	return buf.toString();
    }
506621
public final void setTimeZone(final TimeZone timeZone) {
        for (final Period period : this) {
            period.setTimeZone(timeZone);
        }
        this.timezone = timeZone;
        this.utc = false;
    }
97803
private Integer getIntegerTimeInMinutes(Date date)
   {
      Integer result = null;
      if (date != null)
      {
         Calendar cal = DateHelper.popCalendar(date);
         int time = cal.get(Calendar.HOUR_OF_DAY) * 60;
         time += cal.get(Calendar.MINUTE);
         DateHelper.pushCalendar(cal);
         result = Integer.valueOf(time);         
      }
      return (result);
   }
1355130
@Override
    @SuppressWarnings("unchecked")
    public ChronoZonedDateTime<InternationalFixedDate> zonedDateTime(TemporalAccessor temporal) {
        return (ChronoZonedDateTime<InternationalFixedDate>) super.zonedDateTime(temporal);
    }
1245270
@Override
    public <B extends Appendable> B format(Calendar calendar, final B buf) {
        // do not pass in calendar directly, this will cause TimeZone of FastDatePrinter to be ignored
        if(!calendar.getTimeZone().equals(mTimeZone)) {
            calendar = (Calendar)calendar.clone();
            calendar.setTimeZone(mTimeZone);
        }
        return applyRules(calendar, buf);
    }
50540
public static Calendar round(Calendar calendar, DateField dateField) {
		return DateModifier.modify(calendar, dateField.getValue(), ModifyType.ROUND);
	}
408343
def round(ndigits = 0)
      if_timezone_offset(super) {|o,t| self.class.at(t.to_i, t.subsec * 1_000_000).set_timezone_offset(o) }
    end
352811
public LocalDateTime adjustTime(LocalDateTime time, boolean roundUp,
                                    DayOfWeek firstDayOfWeek) {
        requireNonNull(time);

        if (roundUp) {
            time = time.plus(getAmount(), getUnit());
        }

        return Util.truncate(time, getUnit(), getAmount(), firstDayOfWeek);
    }
909061
public static String toISO8601(Date pDate,TimeZone pTimeZone) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
        dateFormat.setTimeZone(pTimeZone);
        String ret = dateFormat.format(pDate);
        ret = ret.replaceAll("\\+0000$", "Z");
        return ret.replaceAll("(\\d\\d)$", ":$1");
    }
1219281
public ZonedDateTime adjustTime(ZonedDateTime time, boolean roundUp,
                                    DayOfWeek firstDayOfWeek) {
        Instant instant = time.toInstant();
        ZoneId zoneId = time.getZone();
        instant = adjustTime(instant, zoneId, roundUp, firstDayOfWeek);
        return ZonedDateTime.ofInstant(instant, zoneId);
    }