Java Utililty Methods Day Add

List of utility methods to do Day Add

Description

The list of methods to do Day Add are organized into topic(s).

Method

StringaddDayString5(Date date, int day)
add Day String
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE, day);
return convertDate2String5(calendar.getTime());
StringaddDayToString(String strDate, int days)
add Day To String
Calendar cale = toCalendar(strDate);
cale.add(Calendar.DAY_OF_YEAR, days);
return dateFormatterByPattern(cale.getTime(), "yyyy-MM-dd");
StringaddOneDay(String strDate)
add One Day
int[] standardDays = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int[] leapyearDays = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int y = Integer.parseInt(strDate.substring(0, 4));
int m = Integer.parseInt(strDate.substring(4, 6));
int d = Integer.parseInt(strDate.substring(6, 8)) + 1;
int maxDateCount = 0;
System.out.println(y);
System.out.println(m);
...
StringaddOneDayForamt(String date, String format, Integer addDate)
add One Day Foramt
Calendar calendar = Calendar.getInstance();
calendar.setTime(new SimpleDateFormat(format).parse(date));
calendar.add(Calendar.DATE, addDate);
String retDate = new SimpleDateFormat(format).format(calendar.getTime());
return retDate;
java.util.DateAddUtilDate(String strDate, int iDays)
Add Util Date
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date d1 = df.parse(strDate);
return AddDate(d1, iDays);
StringgetAddDay(int day)
get Add Day
String orgDate = null;
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, day);
Date newDate = calendar.getTime();
orgDate = formatDate(newDate);
return orgDate;
DategetFutrueDate(Date oldDate, int addDay)
get Futrue Date
Calendar c = Calendar.getInstance();
c.setTime(oldDate);
c.add(Calendar.DATE, addDay);
return c.getTime();