Java Date Time Java Java API
java.time.MonthDay
public MonthDay with(Month month)
Returns a copy of this MonthDay with the month-of-year replaced with the corresponding field value of the provided Month.
MonthDay
package com.logicbig.example.monthday;import java.time.Month;import java.time.MonthDay;public class WithExample { public static void main(String... args) { MonthDay m = MonthDay.now(); System.out.println(m); MonthDay m2 = m.with(Month.JANUARY); System.out.println(m2); }}
--10-29--01-29