Java Timestamp Now getCurrentTimestamp()

Here you can find the source of getCurrentTimestamp()

Description

getCurrentTimestamp Returns current time in Timestamp object.

License

Open Source License

Return

Timestamp object which representing the current time.

Declaration

public static java.sql.Timestamp getCurrentTimestamp() 

Method Source Code

//package com.java2s;
/*/*from  www.  j a  va 2 s  . co  m*/
* @(#)Utility.java
*
* Copyright (c) 2003 DCIVision Ltd
* All rights reserved.
*
* This software is the confidential and proprietary information of DCIVision
* Ltd ("Confidential Information").  You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the license
* agreement you entered into with DCIVision Ltd.
 */

public class Main {
    /**
     * getCurrentTimestamp
     *
     * Returns current time in Timestamp object.
     *
     * @return  Timestamp object which representing the current time.
     */
    public static java.sql.Timestamp getCurrentTimestamp() {
        java.util.Calendar tmp = java.util.Calendar.getInstance();
        tmp.clear(java.util.Calendar.MILLISECOND);
        return (new java.sql.Timestamp(tmp.getTime().getTime()));
    }
}

Related

  1. getCurrentTimestamp()
  2. getCurrentTimestamp()
  3. getCurrentTimeStamp()
  4. getCurrentTimestamp()
  5. getCurrentTimeStamp()
  6. getCurrentTimestamp()
  7. getCurrentTimeStamp(int offsetDays)
  8. getCurrentTimeStamp(String format)
  9. getCurrentTimestampAsString()