Package java.time

Examples of java.time.Duration$DurationUnits


   * time in terms of seconds and nanoseconds.
   */
  @Test
  public void testDurationToAlterTime() {
    // A duration of 3 seconds and 5 nanoseconds
    Duration duration = Duration.ofSeconds(3, 5);

    // You can modify the values of a DateTime using a Duration
    final LocalDateTime localDateTime = LocalDateTime.of(2014, Month.SEPTEMBER, 1, 17, 29, 40);
    final LocalDateTime futureDateTime = localDateTime.plus(duration);
    assertThat(futureDateTime, is(LocalDateTime.of(localDateTime.toLocalDate(), LocalTime.of(17, 29, 43, 5))));
View Full Code Here

TOP

Related Classes of java.time.Duration$DurationUnits

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.