Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static void setDateTime(long timeStamp, Calendar currentCalender, int i) { currentCalender.setTimeInMillis(timeStamp); currentCalender.set(Calendar.DATE, 1); currentCalender.set(Calendar.HOUR_OF_DAY, 0); currentCalender.set(Calendar.MINUTE, 0); currentCalender.set(Calendar.SECOND, 0); currentCalender.set(Calendar.MILLISECOND, 0); currentCalender.add(Calendar.DATE, i); } }