Java Timestamp Now getTimestamp()

Here you can find the source of getTimestamp()

Description

Accessor method to return current time as a yyyy-MM-dd hh:mm:ss.SSS string (aka SQL TIMESTAMP format)

License

Open Source License

Return

the time string

Declaration

public static String getTimestamp() 

Method Source Code


//package com.java2s;
import java.sql.Timestamp;

import java.util.Date;

public class Main {
    /**/* w  w  w  .  ja  v a 2s .c om*/
     * Accessor method to return current time as a yyyy-MM-dd hh:mm:ss.SSS
     * string (aka SQL TIMESTAMP format)
     *
     * @return the time string
     */
    public static String getTimestamp() {
        long date = (new Date()).getTime();
        return (new Timestamp(date)).toString();
    }
}

Related

  1. getTimeStamp()
  2. getTimeStamp()
  3. getTimestamp()
  4. getTimestamp()
  5. getTimeStamp()
  6. getTimeStamp()
  7. getTimestamp()
  8. getTimestamp()
  9. isCurrentDataByStartdataAndEnddata(Timestamp startDate, Timestamp endDate)