The adjustInto() method of LocalTime class is used to adjusts the specified temporal object to have the same time as this LocatTime Object.
public Temporal adjustInto(Temporal temporal)
Parameters: This method accepts a single parameter temporal which is the target object to be adjusted, and not specifically null.
Return value: This method returns the adjusted temporal object.
Exception: The function throws two exceptions as described below:
- DateTimeException– if unable to make the adjustment
- ArithmeticException – if numeric overflow occurs
Below programs illustrate the adjustInto() method:
ZonedDateTime before adjustInto():2018-12-03T06:30:31.142Z[Etc/UTC] ZonedDateTime after adjustInto():2018-12-03T09:32:42Z[Etc/UTC]
Before adjustInto() OffsetDateTime: 2018-12-03T06:30:33.927Z After adjustInto() OffsetDateTime: 2018-12-03T19:52:43Z
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.