Instant getLong(TemporalField field)
gets the value of the
specified field from this instant as a long.
getLong
has the following syntax.
public long getLong(TemporalField field)
The following example shows how to use getLong
.
import java.time.Instant; import java.time.temporal.ChronoField; /*from ww w . j a v a2s . 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.getLong(ChronoField.NANO_OF_SECOND)); } }
The code above generates the following result.