Java Date Time - Period getDays() example








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 v a 2  s  .  com*/
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.