Create Current Timestamp as a java.sql.Time Object in Java

Description

The following code shows how to create Current Timestamp as a java.sql.Time Object.

Example


//from  w  w  w. ja  v a 2  s . com
public class Main {

  public static void main(String[] args) {

    java.util.Date today = new java.util.Date();
    System.out.println(new java.sql.Time(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