Java Date Time - Period normalized() example








Period normalized() returns a copy of this period with the years and months normalized.

Syntax

normalized has the following syntax.

public Period normalized()

Example

The following example shows how to use normalized.

import java.time.Period;
//from  w  w  w.ja  v  a  2s  .com
public class Main {
  public static void main(String[] args) {
    Period p = Period.ofMonths(123);
    
    Period l = p.normalized();
    System.out.println(l);

  }
}

The code above generates the following result.