Android examples for java.util:Date Format
Get current date and time as a string in yyMMdd-HHmm format. Used for naming backup files.
import android.util.Log; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main{ /**/*from ww w . ja v a 2 s. c o m*/ * Get current date and time as a string. Used for naming backup files. */ public static String getDateForExport() { DateFormat df = new SimpleDateFormat("yyMMdd-HHmm"); return df.format(new Date()); } }