Java Date Time - OffsetTime getNano() example








OffsetTime getNano() gets the nano-of-second field.

Syntax

getNano has the following syntax.

public int getNano()

Example

The following example shows how to use getNano.

import java.time.OffsetTime;
/*w  w w . j av a 2  s .com*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    int n = m.getNano();
    System.out.println(n);

  }
}

The code above generates the following result.