Returns the new instance of a temporal object to having this month-day. The returned temporal object is of the same type as of the input type.

package com.logicbig.example.monthday;
import java.time.*;
import java.time.temporal.Temporal;
public class AdjustIntoExample {
public static void main(String... args) {
MonthDay m = MonthDay.of(10, 20);
System.out.println(m);
adjust(m, LocalDate.now());
adjust(m, LocalDateTime.now());
adjust(m, ZonedDateTime.now());
adjust(m, OffsetDateTime.now());
}
private static void adjust(MonthDay m, Temporal t) {
Temporal t2 = m.adjustInto(t);
System.out.printf("%15s > %s > %s%n",
t.getClass().getSimpleName(),
t, t2);
}
}
Output
--10-20
LocalDate > 2025-10-28 > 2025-10-20
LocalDateTime > 2025-10-28T19:18:48.419 > 2025-10-20T19:18:48.419
ZonedDateTime > 2025-10-28T19:18:48.420+08:00[America/Chicago] > 2025-10-20T19:18:48.420+08:00[America/Chicago]
OffsetDateTime > 2025-10-28T19:18:48.420+08:00 > 2025-10-20T19:18:48.420+08:00