Java Timestamp.getNanos()

Syntax

Timestamp.getNanos() has the following syntax.

public int getNanos()

Example

In the following code shows how to use Timestamp.getNanos() method.


public class Main {
  public static void main(String[] args) {
    java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2005-04-06 09:01:10");
/*w w w . ja  va2s. co  m*/
    
    System.out.println(ts2.getNanos());
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.sql »




DatabaseMetaData
ParameterMetaData
PreparedStatement
ResultSet
Timestamp