Here you can find the source of getCurrentDate(String format)
public static String getCurrentDate(String format)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentDate(String format) { return new SimpleDateFormat(format).format(new Date()); }//w ww. j av a2 s. c o m public static Date getCurrentDate() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String s = sdf.format(new Date()); Date date = null; try { date = sdf.parse(s); } catch (ParseException e) { e.printStackTrace(); } return date; } }