Here you can find the source of getTimeStamp()
public static String getTimeStamp()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String DEFAULT_DATE_FROMAT = "yyyyMMddHHmmss"; public final static String DEFAULT_TIME_STAMP_FROMAT = "yyyy-MM-dd HH:mm:ss"; public static String getTimeStamp() { return formatDateTime(DEFAULT_TIME_STAMP_FROMAT, new Date()); }/*from w w w .j ava 2 s .c o m*/ public static String formatDateTime(java.util.Date date) { return formatDateTime(DEFAULT_DATE_FROMAT, date); } public static String formatDateTime(String pattern, java.util.Date date) { String strDate = null; String strFormat = pattern; SimpleDateFormat dateFormat = null; if (date == null) return ""; dateFormat = new SimpleDateFormat(strFormat); strDate = dateFormat.format(date); return strDate; } }