The getNano() method of Instant class is used to return the number of nanoseconds later in the time-line represented in this instant, from the start of the second. The nanosecond-of-second value which measures the total number of nanoseconds from the second value returned by getEpochSecond().
public int getNano()
Returns: This method returns the nanoseconds within the second value which is always positive and never exceeds 999, 999, 999.
Below programs illustrate the getNano() method:
nanoseconds value: 630000000
Current Instant:2018-11-27T04:21:27.029Z nanoseconds value: 29000000
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.