Java Timestamp Create toSQLTimestamp(Date date)

Here you can find the source of toSQLTimestamp(Date date)

Description

Convert a java.util.date in a java.sql.timestamp, in order to store the information in a jdbc database

License

LGPL

Parameter

Parameter Description
date a parameter

Declaration

public static java.sql.Timestamp toSQLTimestamp(Date date) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.Date;

public class Main {
    /**/*  w w w  . jav a  2 s  . c  om*/
     * Convert a java.util.date in a java.sql.timestamp, in order to store the information
     * in a jdbc database
     * @param date
     * @return
     */
    public static java.sql.Timestamp toSQLTimestamp(Date date) {

        // get the timestamp from the date
        java.sql.Timestamp timestamp = new java.sql.Timestamp(date.getTime());

        // return the timestamp
        return timestamp;
    }
}

Related

  1. toOracleTimestamp(String stringDate, int intFlag)
  2. toSQLTime(Instant timestamp)
  3. toSqlTime(Timestamp timestamp)
  4. toSqlTimestamp(Date d)
  5. toSqlTimeStamp(Date d)
  6. toSQLTimestamp(DateTime dt)
  7. toSqlTimestamp(java.util.Date date)
  8. toSQLTimestamp(Object object, Object oDefault)
  9. toSQLTimestamp(String time)