Java SimpleDateFormat create file name
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getPhotoFileName()); }// w w w . ja v a 2 s . c o m public static String getPhotoFileName() { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyy-MM-dd-HH-mm-ss"); return dateFormat.format(date); } }