Here you can find the source of addDate(String date, SimpleDateFormat format, int dayCnt)
public static String addDate(String date, SimpleDateFormat format, int dayCnt)
//package com.java2s; /*// ww w . ja v a 2 s . c om * @(#)DateUtils.java * * Copyright 2007 NHN Corp. All rights Reserved. * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final int TIMESTAMP_FOR_A_DAY = 1000 * 60 * 60 * 24; public static String addDate(String date, SimpleDateFormat format, int dayCnt) { Date oldDate = new Date(); long curTimeStamp = 0; try { oldDate = format.parse(date); } catch (ParseException e) { return date; } curTimeStamp = oldDate.getTime(); curTimeStamp = curTimeStamp + (TIMESTAMP_FOR_A_DAY * dayCnt); String result = ""; try { result = format.format(new Date(curTimeStamp)); } catch (Exception e) { return date; } return result; } }