Close

Java Date Time - Instant.getNano() Examples

Java Date Time Java Java API 


Class:

java.time.Instant

java.lang.Objectjava.lang.Objectjava.time.Instantjava.time.Instantjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public int getNano()

Returns the corresponding number of nanoseconds from the start of the second of this Instant object.


Examples


package com.logicbig.example.instant;

import java.time.Instant;

public class GetNanoExample {

public static void main(String... args) {
Instant i = Instant.now();
System.out.println(i);

int n = i.getNano();
System.out.println(n);
}
}

Output

2017-05-01T20:57:53.587Z
587000000




See Also