Instant getLong(TemporalField field) example
Description
Instant getLong(TemporalField field)
gets the value of the
specified field from this instant as a long.
Syntax
getLong
has the following syntax.
public long getLong(TemporalField field)
Example
The following example shows how to use getLong
.
import java.time.Instant;
import java.time.temporal.ChronoField;
//from w ww.ja v a 2 s. c o 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.