Here you can find the source of getCurrentDate()
public static String getCurrentDate()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String DEFAULT_DATE_FROMAT = "yyyyMMddHHmmss"; public final static String SIMPLE_DATE_FROMAT = "yyyyMMdd"; public static String getCurrentDate() { return formatDateTime(SIMPLE_DATE_FROMAT, new Date()); }//from ww w . j a v a2 s. c o m public static String formatDateTime(java.util.Date date) { return formatDateTime(DEFAULT_DATE_FROMAT, date); } public static String formatDateTime(String pattern, java.util.Date date) { String strDate = null; String strFormat = pattern; SimpleDateFormat dateFormat = null; if (date == null) return ""; dateFormat = new SimpleDateFormat(strFormat); strDate = dateFormat.format(date); return strDate; } }