Package java.time

Examples of java.time.Period


        return (ChronoLocalDateTime<MinguoDate>)super.atTime(localTime);
    }

    @Override
    public ChronoPeriod until(ChronoLocalDate endDate) {
        Period period = isoDate.until(endDate);
        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
    }
View Full Code Here


        return (ChronoLocalDateTime<ThaiBuddhistDate>) super.atTime(localTime);
    }

    @Override
    public ChronoPeriod until(ChronoLocalDate endDate) {
        Period period = isoDate.until(endDate);
        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
    }
View Full Code Here

            } else if (type == ZoneId.class) {
                ZoneId offsetTime = ZoneId.of(text);
               
                return (T) offsetTime;
            } else if (type == Period.class) {
                Period period = Period.parse(text);
               
                return (T) period;
            } else if (type == Duration.class) {
                Duration duration = Duration.parse(text);
               
View Full Code Here

   * timeline, as opposed to other classes (above) being a point on a timeline.
   */
  @Test
  public void testPeriodToAlterDate() {
    // 3 years, 2 months, 1 day
    final Period period = Period.of(3, 2, 1);
    // Components of a Period are represented by ChronoUnit values
    assertThat(period.get(ChronoUnit.DAYS), is(1L));

    // You can modify the values of a Date using a Period
    final LocalDate localDate = LocalDate.of(2014, Month.SEPTEMBER, 1);
    final LocalDate futureDate = localDate.plus(period);
    assertThat(futureDate, is(LocalDate.of(2017, Month.NOVEMBER, 2)));
View Full Code Here

TOP

Related Classes of java.time.Period

Copyright © 2018 www.massapicom. 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.