Instant with(TemporalAdjuster adjuster)
returns an adjusted copy
of this instant.
with
has the following syntax.
public Instant with(TemporalAdjuster adjuster)
The following example shows how to use with
.
import java.time.Instant; import java.time.temporal.Temporal; //from ww w. j a v a2 s .co 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.