Returns a new interval based on this interval but with a different time
zone id.

@param zone the new time zone
@return a new interval
966237
public Interval withZoneId(ZoneId zone) {
        requireNonNull(zone);
        return new Interval(startDate, startTime, endDate, endTime, zone);
    }
229875
@Override
    ChronoInterval<Moment> newInterval(
        Boundary<Moment> start,
        Boundary<Moment> end
    ) {

        return MomentIntervalFactory.INSTANCE.between(start, end);

    }
10689
private static String getClientTimeZone() {
        return ZonedDateTime.now(SPDateTimeUtil.getTimeZoneId(SPDateTimeUtil.getBrowserTimeZone())).getOffset().getId()
                .replaceAll("Z", "+00:00");
    }
1066011
@Override
    ChronoInterval<PlainTime> newInterval(
        Boundary<PlainTime> start,
        Boundary<PlainTime> end
    ) {

        return ClockIntervalFactory.INSTANCE.between(start, end);

    }
31603
public static MomentInterval from(ChronoInterval<Moment> interval) {

        if (interval instanceof MomentInterval) {
            return MomentInterval.class.cast(interval);
        } else {
            return new MomentInterval(interval.getStart(), interval.getEnd());
        }

    }
234094
public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) {
        if (base == null) {
            throw new IllegalArgumentException("Must supply a chronology");
        }
        base = base.withUTC();
        if (base == null) {
            throw new IllegalArgumentException("UTC chronology must not be null");
        }
        if (zone == null) {
            throw new IllegalArgumentException("DateTimeZone must not be null");
        }
        return new ZonedChronology(base, zone);
    }
441010
public VTimezone generate(TimeZone timezone) throws IllegalArgumentException {
		URI uri;
		try {
			uri = new URI(baseUrl + timezone.getID());
		} catch (URISyntaxException e) {
			throw new IllegalArgumentException(e);
		}

		VTimezone component = cache.get(uri);
		if (component != null) {
			return component.copy();
		}

		ICalendar ical;
		ICalReader reader = null;
		try {
			reader = new ICalReader(getInputStream(uri));
			ical = reader.readNext();
		} catch (FileNotFoundException e) {
			throw notFound(e);
		} catch (IOException e) {
			throw new RuntimeException(e);
		} finally {
			IOUtils.closeQuietly(reader);
		}

		/*
		 * There should always be exactly one iCalendar object in the file, but
		 * check to be sure.
		 */
		if (ical == null) {
			throw notFound(null);
		}

		/*
		 * There should always be exactly one VTIMEZONE component, but check to
		 * be sure.
		 */
		TimezoneInfo tzinfo = ical.getTimezoneInfo();
		Collection<VTimezone> components = tzinfo.getComponents();
		if (components.isEmpty()) {
			components = ical.getComponents(VTimezone.class); //VTIMEZONE components without TZID properties are treated as ordinary components
			if (components.isEmpty()) {
				throw notFound(null);
			}
		}

		component = components.iterator().next();

		/*
		 * There should always be a TZID property, but just in case there there
		 * isn't one, create one.
		 */
		TimezoneId id = component.getTimezoneId();
		if (id == null) {
			component.setTimezoneId(timezone.getID());
		} else {
			String value = ValuedProperty.getValue(id);
			if (value == null || value.trim().length() == 0) {
				id.setValue(timezone.getID());
			}
		}

		cache.put(uri, component);
		return component.copy();
	}
1275034
public static ZoneId getTimeZoneId(final TimeZone tz) {
        return ZoneId.of(tz.getID(), ZoneId.SHORT_IDS);
    }
559451
public Date getFrom() {
        final TimeInterval first = intervals.first();
        if (first != null) {
            return new Date(first.getFrom());
        }
        return null;
    }
1018206
@Override
    public TimeZone cloneAsThawed() {
        JavaTimeZone tz = (JavaTimeZone)super.cloneAsThawed();
        tz.javatz = (java.util.TimeZone)javatz.clone();
        tz.javacal = new java.util.GregorianCalendar(javatz);  // easier than synchronized javacal.clone()
        tz.isFrozen = false;
        return tz;
    }
1172743
public DateTimeZone toDateTimeZone(String id, boolean outputID) {
        if (id == null) {
            throw new IllegalArgumentException();
        }

        // Discover where all the transitions occur and store the results in
        // these lists.
        ArrayList<Transition> transitions = new ArrayList<Transition>();

        // Tail zone picks up remaining transitions in the form of an endless
        // DST cycle.
        DSTZone tailZone = null;

        long millis = Long.MIN_VALUE;
        int saveMillis = 0;
            
        int ruleSetCount = iRuleSets.size();
        for (int i=0; i<ruleSetCount; i++) {
            RuleSet rs = iRuleSets.get(i);
            Transition next = rs.firstTransition(millis);
            if (next == null) {
                continue;
            }
            addTransition(transitions, next);
            millis = next.getMillis();
            saveMillis = next.getSaveMillis();

            // Copy it since we're going to destroy it.
            rs = new RuleSet(rs);

            while ((next = rs.nextTransition(millis, saveMillis)) != null) {
                if (addTransition(transitions, next) && tailZone != null) {
                    // Got the extra transition before DSTZone.
                    break;
                }
                millis = next.getMillis();
                saveMillis = next.getSaveMillis();
                if (tailZone == null && i == ruleSetCount - 1) {
                    tailZone = rs.buildTailZone(id);
                    // If tailZone is not null, don't break out of main loop until
                    // at least one more transition is calculated. This ensures a
                    // correct 'seam' to the DSTZone.
                }
            }

            millis = rs.getUpperLimit(saveMillis);
        }

        // Check if a simpler zone implementation can be returned.
        if (transitions.size() == 0) {
            if (tailZone != null) {
                // This shouldn't happen, but handle just in case.
                return tailZone;
            }
            return buildFixedZone(id, "UTC", 0, 0);
        }
        if (transitions.size() == 1 && tailZone == null) {
            Transition tr = transitions.get(0);
            return buildFixedZone(id, tr.getNameKey(),
                                  tr.getWallOffset(), tr.getStandardOffset());
        }

        PrecalculatedZone zone = PrecalculatedZone.create(id, outputID, transitions, tailZone);
        if (zone.isCachable()) {
            return CachedDateTimeZone.forZone(zone);
        }
        return zone;
    }
699526
public Interval withEndDateTime(LocalDateTime dateTime) {
        requireNonNull(dateTime);
        return new Interval(startDate, startTime, dateTime.toLocalDate(), dateTime.toLocalTime());
    }
630751
public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) {
        return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId);
    }
569784
public static String changeFormatAndTimeZone(String isoTimestamp,
            String toBeTimeFormat, String zoneId) {
        return getTime(changeIsoTimestampToLong(isoTimestamp, zoneId),
                toBeTimeFormat, zoneId);
    }
978045
public static VTimeZone create(String tzid) {
        BasicTimeZone basicTimeZone = TimeZone.getFrozenICUTimeZone(tzid, true);
        if (basicTimeZone == null) {
            return null;
        }
        VTimeZone vtz = new VTimeZone(tzid);
        vtz.tz = (BasicTimeZone) basicTimeZone.cloneAsThawed();
        vtz.olsonzid = vtz.tz.getID();

        return vtz;
    }
190691
public static ZoneId toZoneId(TimeZone tz) {
        // Android-changed: don't support "old mapping"
        return ZoneId.of(tz.getID(), ZoneId.SHORT_IDS);
    }
446173
public Chronology withZone(DateTimeZone zone) {
        if (zone == null) {
            zone = DateTimeZone.getDefault();
        }
        if (zone == getZone()) {
            return this;
        }

        if (zone == DateTimeZone.UTC && iWithUTC != null) {
            return iWithUTC;
        }

        DateTime lowerLimit = iLowerLimit;
        if (lowerLimit != null) {
            MutableDateTime mdt = lowerLimit.toMutableDateTime();
            mdt.setZoneRetainFields(zone);
            lowerLimit = mdt.toDateTime();
        }

        DateTime upperLimit = iUpperLimit;
        if (upperLimit != null) {
            MutableDateTime mdt = upperLimit.toMutableDateTime();
            mdt.setZoneRetainFields(zone);
            upperLimit = mdt.toDateTime();
        }
        
        LimitChronology chrono = getInstance
            (getBase().withZone(zone), lowerLimit, upperLimit);

        if (zone == DateTimeZone.UTC) {
            iWithUTC = chrono;
        }

        return chrono;
    }