Java Date Time Java Java API
java.time.Period
public int getMonths()
Returns the amount of months of this period.
package com.logicbig.example.period;import java.time.Period;public class GetMonthsExample { public static void main(String... args) { Period p = Period.of(100, 10, 20); System.out.println(p); int m = p.getMonths(); System.out.println(m); }}
P100Y10M20D10