Here you can find the source of getCurrentDate_YYYY_MM_DD()
public static String getCurrentDate_YYYY_MM_DD()
//package com.java2s; import java.util.*; public class Main { /**//from ww w . ja v a 2 s . c o m * Here get the current date in format 'YYYY-MM-DD' * * @return Current date in format 'YYYY-MM-DD' */ public static String getCurrentDate_YYYY_MM_DD() { // get current date in Format YYYY-MM-DD Calendar cal = Calendar.getInstance(TimeZone.getDefault()); final String dateFormat = "yyyy-MM-dd"; java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(dateFormat); sdf.setTimeZone(TimeZone.getDefault()); return sdf.format(cal.getTime()); } }