Instant get(TemporalField field)
gets the value
of the specified field from this instant as an int.
get
has the following syntax.
public int get(TemporalField field)
The following example shows how to use get
.
import java.time.Instant; import java.time.temporal.ChronoField; /*w w w . ja va 2s .co m*/ public class Main { public static void main(String[] args) { Instant instant = Instant.parse("2014-12-03T10:15:30.00Z"); System.out.println(instant.get(ChronoField.NANO_OF_SECOND)); } }
The code above generates the following result.