Here you can find the source of formatcurrentDate(int format)
public static String formatcurrentDate(int format)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String[] SIMPLE_TIME_FORMAT = { "yyyy-MM-dd", "yyyy-MM-dd-HH", "yyyy-MM-dd-HH-mm", "yyyy-MM-dd-HH-mm-ss" }; public static String formatcurrentDate(int format) { return formatDate(new Date(), format, ""); }/*from w ww. j ava 2s. c om*/ public static String formatDate(long timeMilliSeconds, int format) { return formatDate(new Date(timeMilliSeconds), format, ""); } public static String formatDate(long timeMilliSeconds, int format, String delimiter) { return formatDate(new Date(timeMilliSeconds), format, delimiter); } private static String formatDate(Date date, int format, String delimiter) { return formatDate(format, delimiter).format(date); } private static SimpleDateFormat formatDate(int format, String delimiter) { assert format >= 0 && format < SIMPLE_TIME_FORMAT.length; String formatString = SIMPLE_TIME_FORMAT[format]; if (delimiter != null) { formatString = formatString.replace("-", delimiter); } return new SimpleDateFormat(formatString); } }