Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import android.widget.DatePicker; public class Main { public static void initDatePicker(DatePicker datePicker, long date) { datePicker.init(getYear(date), getMonthOfYear(date), getDayOfMonth(date), null); } public static int getYear(long date) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(date); return c.get(Calendar.YEAR); } public static int getMonthOfYear(long date) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(date); return c.get(Calendar.MONTH); } public static int getDayOfMonth(long date) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(date); return c.get(Calendar.DAY_OF_MONTH); } }