Java Date Time - Month adjustInto(Temporal temporal) example








Month adjustInto(Temporal temporal) adjusts the specified temporal object to have this month-of-year.

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.Month;
import java.time.temporal.Temporal;
//from w  w w. j a v  a2 s  . c  o  m
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    Temporal n = m.adjustInto(LocalDate.now());
    System.out.println(n);

  }
}

The code above generates the following result.