Java Timestamp.getTime()

Syntax

Timestamp.getTime() has the following syntax.

public long getTime()

Example

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


public class Main {
  public static void main(String[] args) {
    java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2005-04-06 09:01:10");
//from  ww  w.ja v  a  2s  . co m
    long tsTime2 = ts2.getTime();
    
    System.out.println(tsTime2);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.sql »




DatabaseMetaData
ParameterMetaData
PreparedStatement
ResultSet
Timestamp