Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getBackupFileName() { Calendar c = Calendar.getInstance(); SimpleDateFormat format1 = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); return format1.format(c.getTime()) + ".txt"; } }