Duration ofDays(long days) example

Description

Duration ofDays(long days) creates a Duration representing a number of standard 24 hour days.

Syntax

ofDays has the following syntax.


public static Duration ofDays(long days)

Example

The following example shows how to use ofDays.


import java.time.Duration;
//from  w ww .jav a 2 s  . c o  m
public class Main {
  public static void main(String[] args) {
    Duration duration = Duration.ofDays(10);
    System.out.println(duration);
  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset