Here you can find the source of getTimeStamp()
public static synchronized String getTimeStamp()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w w w .j a v a 2 s . c om*/ * @return The current timestamp and am/pm marker. */ public static synchronized String getTimeStamp() { Date timeStamp = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_a_hhmmss"); return dateFormat.format(timeStamp); } }