Java API Tutorial - 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.

//from   w  ww  .j  av  a2 s .c  om
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.