Here you can find the source of currentDate(String format)
public static String currentDate(String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String currentDate(String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(isBlank(format) ? "yyyy-MM-dd HH:mm:ss" : format); return dateFormat.format(new Date()); }//from w ww. j a v a 2 s . c om public static String currentDate() { return currentDate(""); } public static boolean isBlank(String str) { return (isEmpty(str) || (str.trim().length() == 0)); } public static boolean isEmpty(String str) { return (str == null || str.length() == 0); } }