Here you can find the source of getCurrentDateFormat()
public static String getCurrentDateFormat()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from ww w .j a v a 2 s.c o m*/ * default date format pattern */ public final static String DATE_FORMAT = "yyyy-MM-dd"; /** * get current date * * @return the string of current date */ public static String getCurrentDateFormat() { return formatDate(new Date()); } /** * format date with the default pattern * * @param date the date that want to format to string * @return the formated date */ public static String formatDate(Date date) { SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); return format.format(date); } /** * format date with the given pattern * * @param date the date that want to format to string * @param pattern the formated pattern * @return the formated date */ public static String formatDate(Date date, String pattern) { if (date == null) { return null; } SimpleDateFormat format = new SimpleDateFormat(pattern); return format.format(date); } }