Here you can find the source of getDaysMonthYear(Date date)
public static Hashtable<String, Object> getDaysMonthYear(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Hashtable; public class Main { public static Hashtable<String, Object> getDaysMonthYear(Date date) { Hashtable<String, Object> _value = new Hashtable<String, Object>(); Calendar _calendar = Calendar.getInstance(); _calendar.setTime(date);/* ww w.j a v a 2s. co m*/ int _days = _calendar.getActualMaximum(Calendar.DAY_OF_MONTH); String _month = getMonth(date); String _year = getYear(date); _value.put("days", _days); _value.put("month", _month); _value.put("year", _year); return _value; } public static String getMonth(Date date) { SimpleDateFormat _sdf = new SimpleDateFormat("MM"); String _value = _sdf.format(date); return _value; } public static String getYear(Date date) { SimpleDateFormat _sdf = new SimpleDateFormat("yyyy"); String _value = _sdf.format(date); return _value; } }