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(). Syntax:
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: Program 1:Â
Java
// Java program to demonstrate // Instant.getNano() method Â
import java.time.*; Â
public class GFG { Â Â Â Â public static void main(String[] args) Â Â Â Â { Â
        // create a Instant object         Instant instant             = Instant.parse(" 2018 - 12 -30T19: 34 : 50 .63Z"); Â
        // get nano second of secondvalue         // using getNano()         int value = instant.getNano(); Â
        // print result         System.out.println("nanoseconds value: "                            + value);     } } |
nanoseconds value: 630000000
Program 2:Â
Java
// Java program to demonstrate // Instant.getNano() method Â
import java.time.*; Â
public class GFG { Â Â Â Â public static void main(String[] args) Â Â Â Â { Â
        // create a Instant object         Instant instant = Instant.now(); Â
        // current Instant         System.out.println("Current Instant:"                            + instant); Â
        // get nano second of secondvalue         // using getNano()         int value = instant.getNano(); Â
        // print result         System.out.println("nanoseconds value: "                            + value);     } } |
Current Instant:2018-11-27T04:21:27.029Z nanoseconds value: 29000000
References: https://docs.oracle.com/javase/10/docs/api/java/time/Instant.html#getNano()