Java Timestamp Now getCurrentTimestamp()

Here you can find the source of getCurrentTimestamp()

Description

Returns a Timestamp object, using milliseconds since January 1, 1970, 00:00:00 GMT.

License

Open Source License

Return

a Timestamp object using milliseconds since January 1, 1970, 00:00:00 GMT

Declaration

public static java.sql.Timestamp getCurrentTimestamp() 

Method Source Code


//package com.java2s;
/*//w  w w.j a  va 2  s  . com
 * Copyright (c) Red de Pruebas C.A. All rights reserved.
 * RED DE PRUEBAS C.A. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

import java.util.Calendar;

public class Main {
    /**
     * Returns a <code>Timestamp</code> object, using milliseconds since January
     * 1, 1970, 00:00:00 GMT.
     * <p>
     * From a <code>Calendar</code> object based on the current time in the
     * default time zone with the default locale, gets a <code>Date</code>
     * object representing this <code>Calendar</code>'s time value (millisecond
     * offset from the <a href="#Epoch">Epoch</a>").
     * <p>
     * Then gets the number of milliseconds since January 1, 1970, 00:00:00 GMT
     * represented by this <tt>Date</tt> object and finally constructs a
     * <code>Timestamp</code> object using milliseconds time value.
     *
     * @return a <code>Timestamp</code> object using milliseconds since January
     * 1, 1970, 00:00:00 GMT
     * @see java.util.Calendar#getInstance()
     * @see java.util.Calendar#getTime()
     * @see java.util.Date#getTime()
     * @see java.sql.Timestamp#Timestamp(long)
     * @since 0.1
     */
    public static java.sql.Timestamp getCurrentTimestamp() {
        return new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
    }
}

Related

  1. getCurrentSQLTimestamp()
  2. getCurrentTimeStamp()
  3. getCurrentTimeStamp()
  4. getCurrentTimeStamp()
  5. getCurrentTimestamp()
  6. getCurrentTimestamp()
  7. getCurrentTimeStamp()
  8. getCurrentTimestamp()
  9. getCurrentTimeStamp()