Here you can find the source of offsetDay(Date date, int offset)
public static Date offsetDay(Date date, int offset)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date offsetDay(Date date, int offset) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from w ww .j av a2 s . c o m*/ calendar.set(Calendar.DAY_OF_YEAR, (calendar.get(Calendar.DAY_OF_YEAR) + offset)); return calendar.getTime(); } }