@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<JapaneseDate> zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime<JapaneseDate>) super.zonedDateTime(temporal); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<ThaiBuddhistDate> zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime<ThaiBuddhistDate>) super.zonedDateTime(temporal); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<ThaiBuddhistDate> zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime<ThaiBuddhistDate>) super.zonedDateTime(instant, zone); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<HijrahDate> zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime<HijrahDate>) super.zonedDateTime(instant, zone); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<JapaneseDate> zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime<JapaneseDate>) super.zonedDateTime(instant, zone); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<HijrahDate> zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime<HijrahDate>) super.zonedDateTime(temporal); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<MinguoDate> zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime<MinguoDate>) super.zonedDateTime(temporal); }
@SuppressWarnings("unchecked") @Override // override with covariant return type public ChronoZonedDateTime<MinguoDate> zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime<MinguoDate>) super.zonedDateTime(instant, zone); }
private void mergeInstantFields0(ZoneId selectedZone) { Instant instant = Instant.ofEpochSecond(fieldValues.remove(INSTANT_SECONDS)); ChronoZonedDateTime<?> zdt = chrono.zonedDateTime(instant, selectedZone); if (date == null) { addObject(zdt.toLocalDate()); } else { resolveMakeChanges(INSTANT_SECONDS, zdt.toLocalDate()); } addFieldValue(SECOND_OF_DAY, (long) zdt.toLocalTime().toSecondOfDay()); }
throw new DateTimeException("No Chronology found to create ChronoZonedDateTime: " + temporal.getClass()); return chrono.zonedDateTime(temporal);
@Override public long until(Temporal endExclusive, TemporalUnit unit) { @SuppressWarnings("unchecked") ChronoZonedDateTime<D> end = (ChronoZonedDateTime<D>) toLocalDate().getChronology().zonedDateTime(endExclusive); if (unit instanceof ChronoUnit) { end = end.withZoneSameInstant(offset); return dateTime.until(end.toLocalDateTime(), unit); } return unit.between(this, end); }
/** * Obtains a zoned date-time in this chronology from another temporal object. * <p> * This creates a date-time in this chronology based on the specified {@code TemporalAccessor}. * <p> * This should obtain a {@code ZoneId} using {@link ZoneId#from(TemporalAccessor)}. * The date-time should be obtained by obtaining an {@code Instant}. * If that fails, the local date-time should be used. * * @param temporal the temporal object to convert, not null * @return the zoned date-time in this chronology, not null * @throws DateTimeException if unable to create the date-time */ @SuppressWarnings({ "rawtypes", "unchecked" }) public ChronoZonedDateTime<?> zonedDateTime(TemporalAccessor temporal) { try { ZoneId zone = ZoneId.from(temporal); try { Instant instant = Instant.from(temporal); return zonedDateTime(instant, zone); } catch (DateTimeException ex1) { ChronoLocalDateTime cldt = localDateTime(temporal); ChronoLocalDateTimeImpl cldtImpl = ensureChronoLocalDateTime(cldt); return ChronoZonedDateTimeImpl.ofBest(cldtImpl, zone, null); } } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass(), ex); } }
return chrono.zonedDateTime(Instant.from(temporal), overrideZone);