Here you can find the source of getCurrentDate()
public static Date getCurrentDate()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getCurrentDate() { Date now = getCurrentDateTime(); return strToDate(dateToStr(now)); }/*from ww w. j a v a 2 s.c o m*/ /** * @return */ public static Date getCurrentDateTime() { java.util.Calendar calendar = java.util.Calendar.getInstance(); return calendar.getTime(); } public static Date strToDate(String s) { Date d = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { d = sdf.parse(s); } catch (Exception e) { } return d; } public static String dateToStr(Date date) { String s = ""; if (date == null) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { s = sdf.format(date); } catch (Exception e) { } return s; } }