Here you can find the source of getTimestamp()
static String getTimestamp()
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { static String getTimestamp() { return formatTimestamp(new Date()); }//from w w w . j a va2 s .co m static String formatTimestamp(Date date) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return dateFormat.format(date); } }