Period ofDays(int days) example

Description

Period ofDays(int days) creates a Period representing a number of days.

Syntax

ofDays has the following syntax.


public static Period ofDays(int days)

Example

The following example shows how to use ofDays.


import java.time.Period;
//from w w w. j a  v  a2s  . com
public class Main {
  public static void main(String[] args) {
    
    Period p = Period.ofDays(12);

    System.out.println(p.toString());

  }
}

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