Here you can find the source of getCurrentDate()
public static String getCurrentDate()
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getCurrentDate() { return getCurrentDateTime().substring(0, 11); }//from w w w.ja v a2 s.co m public static String getCurrentDateTime() { DateFormat dateFormat = new SimpleDateFormat("_yyyy-MM-dd_HH-mm-ss"); Calendar cal = Calendar.getInstance(); String time = "" + dateFormat.format(cal.getTime()); return time; } }