Java Timestamp.valueOf(String s)

Syntax

Timestamp.valueOf(String s) has the following syntax.

public static Timestamp valueOf(String s)

Example

In the following code shows how to use Timestamp.valueOf(String s) method.


/* w w w  . j a v  a 2 s.  co m*/
public class Main {
  public static void main(String[] args) {
    java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2013-04-06 09:01:10");

    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