Here you can find the source of getTimestamp()
public static String getTimestamp()
//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(); } }