Here you can find the source of getTimestamp(Date date, String timestampPattern)
public static String getTimestamp(Date date, String timestampPattern)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTimestamp(Date date, String timestampPattern) { if (date != null && timestampPattern != null) { SimpleDateFormat formatter = new SimpleDateFormat(timestampPattern); return formatter.format(date); }//from w w w . ja v a2 s .c o m return date != null ? date.toString() : null; } }