Java Date Time Java Java API
java.time.MonthDay
public MonthDay withMonth(int month)
Returns a copy of this MonthDay with the month-of-year replaced with the provided month value
MonthDay
package com.logicbig.example.monthday;import java.time.MonthDay;public class WithMonthExample { public static void main(String... args) { MonthDay m = MonthDay.of(4, 10); System.out.println(m); MonthDay m2 = m.withMonth(12); System.out.println(m2); }}
--04-10--12-10