Here you can find the source of getTimeFileName(String suffix)
Parameter | Description |
---|
public static String getTimeFileName(String suffix)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTimeFileName(String suffix) { return formatDate(new Date(), "yyyyMMddHHmmssSSS") + suffix; }/* w w w . jav a 2s . com*/ public static String formatDate(Date date, String patter) { try { SimpleDateFormat sdf = new SimpleDateFormat(patter); return sdf.format(date); } catch (RuntimeException e) { return ""; } } public static String formatDate(Date date) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); } catch (RuntimeException e) { return ""; } } }