Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.TimeZone; public class Main { public static final long MILLISECONDS_PER_DAY = 1000L * 3600 * 24; public static Calendar calendarFromDays(long days) { return calendarLocal_FromMilliseconds(days * MILLISECONDS_PER_DAY - TimeZone.getDefault().getRawOffset()); } public static Calendar calendarLocal_FromMilliseconds(long msUTC) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(msUTC); return c; } }