Package javax.time.period

Examples of javax.time.period.PeriodFields.toDuration()


     * @throws ArithmeticException if the calculation exceeds the capacity of {@code Instant}
     * @throws CalendricalException if the calculation exceeds the capacity of {@code ZonedDateTime}
     */
    public ZonedDateTime plusDuration(PeriodProvider periodProvider) {
        PeriodFields period = PeriodFields.from(periodProvider);
        Duration duration = period.toDuration();
        return duration.isZero() ? this : fromInstant(toInstant().plus(duration), zone);
    }

    /**
     * Returns a copy of this {@code ZonedDateTime} with the specified duration added.
View Full Code Here


     * @throws ArithmeticException if the calculation exceeds the capacity of {@code Instant}
     * @throws CalendricalException if the calculation exceeds the capacity of {@code ZonedDateTime}
     */
    public ZonedDateTime minusDuration(PeriodProvider periodProvider) {
        PeriodFields period = PeriodFields.from(periodProvider);
        Duration duration = period.toDuration();
        return duration.isZero() ? this : fromInstant(toInstant().minus(duration), zone);
    }

    /**
     * Returns a copy of this {@code ZonedDateTime} with the specified duration subtracted.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.