This method returns a copy of this period with the years and months normalized. The months unit is adjusted to have an absolute value less than 11, with the years unit being adjusted to compensate. For example, a period of "1 Year and 15 months" will be normalized to "2 years and 3 months". This method leaves the days unit unchanged
The sign of the years and months units will be the same after normalization.
Examples
package com.logicbig.example.period;
import java.time.Period;
public class NormalizedExample {
public static void main(String... args) { Period p = Period.of(100, 100, 20); System.out.println(p);
Period p2 = p.normalized(); System.out.println(p2); } }
Output
P100Y100M20D P108Y4M20D
This example shows that normalized() method does not change the days.
package com.logicbig.example.period;
import java.time.Period;
public class NormalizedExample2 {
public static void main(String... args) { Period p = Period.of(100, -10, 200); System.out.println(p);
Period p2 = p.normalized(); System.out.println(p2); } }