Java Date Time - Duration ofDays(long days) example








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;

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.