Construct java.sql.Timestamp from string : Date Time Timestamp : Database SQL JDBC : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Database SQL JDBC   » [  Date Time Timestamp  ]  Screenshots 
 



Construct java.sql.Timestamp from string


public class DateLabel {
  public static void main(String[] args) {
    java.util.Date today = new java.util.Date();
    java.sql.Timestamp ts1 = new java.sql.Timestamp(today.getTime());
    java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2005-04-06 09:01:10");

    long tsTime1 = ts1.getTime();
    long tsTime2 = ts2.getTime();
    
    System.out.println(tsTime1);
    System.out.println(tsTime2);
  }
}

           
       
Related examples in the same category
1.  Convert java.sql.Timestamp to long for easy compare
2.  Get Date From MySql
3.  Get java.sql.Timestamp fro current time
4.  Get date from Oracle
5.  Inser Date, time and date time data to Oracle
6.  Demo PreparedStatement Set Time
7.  Demo PreparedStatement Set Timestamp
8.  Demo PreparedStatement Set Date
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.