Here you can find the source of timeStampForFileName(final String simpleDateFormat)
public static String timeStampForFileName(final String simpleDateFormat)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String timeStampForFileName() { return timeStampForFileName("yyyy-MM-dd_HH-mm"); }/*from w w w.java 2 s . c om*/ public static String timeStampForFileName(final String simpleDateFormat) { Date currentDateTime = new Date(System.currentTimeMillis()); SimpleDateFormat humanReadableFormat = new SimpleDateFormat(simpleDateFormat); return humanReadableFormat.format(currentDateTime); } }