Here you can find the source of AddSqlDate(String strDate, int iDays)
public static java.sql.Date AddSqlDate(String strDate, int iDays) throws Exception
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static java.sql.Date AddSqlDate(String strDate, int iDays) throws Exception { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date d1 = df.parse(strDate); return new java.sql.Date(AddDate(d1, iDays).getTime()); }// w w w .j av a 2s . c om /** * * @param date * Date * @param days * int * @return Date */ public static Date AddDate(Date date, int days) { Calendar c = Calendar.getInstance(); c.setTime(date); long lTmp = c.getTimeInMillis(); c.setTimeInMillis(lTmp + ((long) days) * 24 * 3600 * 1000); return c.getTime(); } }