Here you can find the source of getTimeStamp(String style, Date date)
public static String getTimeStamp(String style, Date date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTimeStamp() { DateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); return format.format(new Date()); }//w ww .j a va 2 s .c o m public static String getTimeStamp(String style, Date date) { DateFormat format = new SimpleDateFormat(style); return format.format(date); } }