Here you can find the source of getCurrentYearMonthDay()
@SuppressWarnings("deprecation") public static final Date getCurrentYearMonthDay()
//package com.java2s; import java.util.*; public class Main { @SuppressWarnings("deprecation") public static final Date getCurrentYearMonthDay() { Date date = new Date(); return new Date(date.getYear(), date.getMonth(), date.getDate()); }//from www. ja v a 2 s. c o m public static int getYear(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); int year = cal.get(Calendar.YEAR); return year; } public static int getMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); int month = cal.get(Calendar.MONTH); return (month + 1); } }