Java Instant adjustInto() methodThe adjustInto() method of Java Instant class is used to adjust the specified Temporal(Interface) object which have this instant. This method returns a temporal object of the same observable type as the input with the instant changed to be the same as this. SyntaxParameterstemporal - The target object to be adjusted, not null ReturnThe adjusted object, not null The adjustment is equivalent to using Temporal.with(TemporalField, long) twice,passing ChronoField.INSTANT_SECONDS and ChronoField.NANO_OF_SECOND as the fields. In most cases, it is clearer to reverse the calling pattArn by using Temporal.with(TemporalAdjuster): ExceptionsDateTimeException - If unable to make the adjustment ArithmeticException - If numeric overflow occurs Example 1Output: The output will be like this. 2014-12-03T10:15:30Z[Asia/New_Delhi] Example 2Output: 2017-03-10T11:10:35.454+05:30[Asia/Calcutta] 2017-02-03T16:07:30+05:30[Asia/Calcutta] Example 3Output: 2017-04-09T10:15:30Z OffsetDateTime > 2017-05-01T15:50:28.538-05:00 > 2017-04-09T05:15:30-05:00 ZonedDateTime > 2017-05-01T15:50:28.540-05:00[Asia/New_Delhi] > 2017-04-09T05:15:30-05:00[Asia/New_Delhi] Instant > 2017-05-01T20:50:28.540Z > 2017-04-09T10:15:30Z Next TopicPHP Date()/Time() Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India