MonthDay adjustInto(Temporal temporal) example

Description

MonthDay adjustInto(Temporal temporal) adjusts the specified temporal object to have this month-day.

Syntax

adjustInto has the following syntax.


public Temporal adjustInto(Temporal temporal)

Example

The following example shows how to use adjustInto.


import java.time.LocalDate;
import java.time.MonthDay;
import java.time.temporal.Temporal;
/*from  www .  ja  v a 2  s . c  o  m*/
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    Temporal n = m.adjustInto(LocalDate.now());
    System.out.println(n);

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset