Here you can find the source of getTimestamp(String pattern)
public static String getTimestamp(String pattern)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { static final Locale currentLocale = Locale.getDefault(); public static String getTimestamp(String pattern) { return getTime(new Date(), pattern, currentLocale); }/*from ww w.j ava 2s.c o m*/ public static String getTimestamp(String pattern, Locale locale) { return getTime(new Date(), pattern, locale); } public static String getTime(Date date, String pattern) { return getTime(date, pattern, currentLocale); } public static String getTime(Date date, String pattern, Locale locale) { SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale); return formatter.format(date); } }