Create a Timestamp Object Using java.util.Date in Java

Description

The following code shows how to create a Timestamp Object Using java.util.Date.

Example


//www .  java  2  s . c  o  m

public class Main {

  public static void main(String[] args) {

    java.util.Date today = new java.util.Date();
    System.out.println(new java.sql.Timestamp(today.getTime()));

  }

}

The code above generates the following result.





















Home »
  Java Tutorial »
    JDBC »




Batch
Binary Data
Database
Date Time
Insert
ResultSet
SQL
Statement
Stored Function
Table