Java Timestamp Now getCurrentDBTimestamp()

Here you can find the source of getCurrentDBTimestamp()

Description

Method to return current db time in Timestamp formate

License

Apache License

Return

Timestamp db timestamp format

Declaration

public static Timestamp getCurrentDBTimestamp() 

Method Source Code


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

import java.sql.*;

import java.text.SimpleDateFormat;

public class Main {
    /**/*  w  ww .j a va  2s . c o  m*/
     * Method to return current db time in Timestamp formate
     *
     * @return Timestamp db timestamp format
     */
    public static Timestamp getCurrentDBTimestamp() {
        SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String strDate = simple.format(new java.util.Date());
        Timestamp timestamp = Timestamp.valueOf(strDate);
        return timestamp;
    }
}

Related

  1. generateTimestamp()
  2. getAfterSecond(Timestamp currentDate)
  3. getCurrentAgeForDate(Timestamp birthDate, Timestamp endDate)
  4. getCurrentDateAsTimestamp()
  5. getCurrentDateTimestamp()
  6. getCurrentSQLTimestamp()
  7. getCurrentSQLTimestamp()
  8. getCurrentTimestamp()
  9. getCurrentTimestamp()