Java Date Time - LocalTime adjustInto(Temporal temporal) example








LocalTime adjustInto(Temporal temporal) adjusts the specified temporal object to have the same time as this object.

Syntax

adjustInto has the following syntax.

public Temporal adjustInto(Temporal temporal)

Example

The following example shows how to use adjustInto.

import java.time.LocalTime;
import java.time.temporal.Temporal;
//www . j  ava  2 s.c  o  m
public class Main {
  public static void main(String[] args) {
    LocalTime l = LocalTime.now();
    LocalTime t = LocalTime.NOON;
    Temporal s = l.adjustInto(t);
    System.out.println(s);
  }
}

The code above generates the following result.