Instant with(TemporalAdjuster adjuster) example
Description
Instant with(TemporalAdjuster adjuster)
returns an adjusted copy
of this instant.
Syntax
with
has the following syntax.
public Instant with(TemporalAdjuster adjuster)
Example
The following example shows how to use with
.
import java.time.Instant;
import java.time.temporal.Temporal;
/*from w ww . j ava 2 s . c o m*/
public class Main {
public static void main(String[] args) {
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
Temporal t = instant.adjustInto(Instant.now());
System.out.println(t);
}
}
The code above generates the following result.