Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static final long MILLISECONDS_PER_DAY = 1000L * 3600 * 24; public static int dayFrom_CalendarLocal(Calendar c) { return dayFrom_Milliseconds(c.getTimeInMillis() + c.get(Calendar.ZONE_OFFSET)); } public static int dayFrom_Milliseconds(long milliseconds) { return (int) (milliseconds / MILLISECONDS_PER_DAY); } }