Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { /** * Returns the year (index 0), month (index 1) and day (index 2) of the given timestamp. * @param timestamp the timestamp * @return the year (index 0), month (index 1) and day (index 2) of the given timestamp */ public static int[] getDayMonthYear(long timestamp) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTimeInMillis(timestamp); int day = gregorianCalendar.get(Calendar.DAY_OF_MONTH); int month = gregorianCalendar.get(Calendar.MONTH) + 1; int year = gregorianCalendar.get(Calendar.YEAR); return new int[] { year, month, day }; } }