Here you can find the source of getYearMonthDay(Date date)
public static int[] getYearMonthDay(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int[] getYearMonthDay(Date date) { Calendar bgnDate = Calendar.getInstance(); bgnDate.setTime(date);/*from w ww . ja va2 s .c om*/ return new int[] { bgnDate.get(Calendar.YEAR), bgnDate.get(Calendar.MONTH) + 1, bgnDate.get(Calendar.DATE) }; } }