Java Date Time - Year adjustInto(Temporal temporal) example








Year adjustInto(Temporal temporal) adjusts the specified temporal object to have this year.

Syntax

adjustInto has the following syntax.

public Temporal adjustInto(Temporal temporal)

Example

The following example shows how to use adjustInto.

import java.time.Year;
import java.time.temporal.Temporal;
//from w  w w  .  j a va 2  s .c  om
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);
    Temporal l = y.adjustInto(Year.of(2000));
    System.out.println(l);

  }
}

The code above generates the following result.