Period getDays() example

Description

Period getDays() gets the amount of days of this period. This returns the days unit.

Syntax

getDays has the following syntax.


public int getDays()

Example

The following example shows how to use getDays.


import java.time.Period;
/* w w  w .ja  va  2 s.  c o m*/
public class Main {
  public static void main(String[] args) {
    Period p = Period.ofMonths(1);
    
    System.out.println(p.getDays());

  }
}

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