We would like to know how to create Period for 2 months and 5 days.
// w w w .ja v a 2 s .c om import java.time.Period; public class Main { public static void main(String[] args) { Period twoMonthsAndFiveDays = Period.ofMonths(2).plusDays(5); System.out.println(twoMonthsAndFiveDays); } }
The code above generates the following result.