Here you can find the source of currentDate()
public static String currentDate()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static final String DATE_FORMAT_DAY = "yyyy-MM-dd"; /**/*w w w . ja v a 2 s .c o m*/ * Get todays date in string form WITHOUT a time-stamp * * @return todays date as a string */ public static String currentDate() { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_DAY); return sdf.format(cal.getTime()); } }