Here you can find the source of getDiffTargetDate(Calendar cal, int diffDay)
public static Date getDiffTargetDate(Calendar cal, int diffDay)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getDiffTargetDate(Calendar cal, int diffDay) { if (null == cal) { cal = Calendar.getInstance(); }//from www .j a v a 2 s .co m // cal.set(cal.DAY_OF_YEAR, cal.get(cal.DAY_OF_YEAR)+diffDay); cal.add(Calendar.DATE, diffDay); return cal.getTime(); } }