List of utility methods to do Day Add
Date | addDays(final Date date, final int days) Returns a date a given number of days after the requested date final GregorianCalendar c = gregorianCalendarThreadLocal.get(); c.setTime(date); c.add(Calendar.DATE, days); return c.getTime(); |
String | addDays(int days) add Days GregorianCalendar cal = new GregorianCalendar(); cal.setTime(new Date()); cal.add(Calendar.DATE, days); return yyyyMMdd.format(cal.getTime()); |
Date | addDays(int days, Date date) add Days Calendar calendar = newCalendar(date);
calendar.add(Calendar.DAY_OF_MONTH, days);
return calendar.getTime();
|
Integer | addDays(Integer dateAsInt, Integer daysToAdd) addDays: returns the integer as date {talendTypes} String {Category} TimestampUtil {param} Integer(dateAsInt) dateAsInt : {param} Integer(daysToAdd) daysToAdd : {example} addDays(dateAsInt, daysToAdd) # 20150403 if (dateAsInt != null) { java.util.Calendar c = java.util.Calendar.getInstance(); c.set(java.util.Calendar.MINUTE, 0); c.set(java.util.Calendar.SECOND, 0); c.set(java.util.Calendar.MILLISECOND, 0); c.set(java.util.Calendar.HOUR_OF_DAY, 0); int year = dateAsInt / 10000; int monthDay = (dateAsInt - (year * 10000)); ... |
Date | addDays(java.util.Date value, final int days) add Days final Calendar cal = Calendar.getInstance(); cal.setTime(value); cal.add(Calendar.DATE, days); final Date adjusted = cal.getTime(); return adjusted; |
long | AddDays(long initialDateMilliSeconds, int dayNumber) Add Days return initialDateMilliSeconds + dayNumber * 24 * 3600 * 1000;
|
Date | addDays(String dateStr, int days) add Days SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date date = sdf.parse(dateStr); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, 15); return cal.getTime(); } catch (Exception e) { ... |
String | addDays(String dateStr, int nDays, String inputDateFormat, String outputDateFormat) add days to a given date try { DateFormat inputFormatter = new SimpleDateFormat(inputDateFormat); DateFormat outputFormatter = inputDateFormat.equals(outputDateFormat) ? inputFormatter : new SimpleDateFormat(outputDateFormat); Date date = (Date) inputFormatter.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DATE, nDays); ... |
String | addDays(String s, int day) add Days return addDays(s, day, "yyyyMMdd"); |
String | addDays(String src, int day, String format) add Days SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK); Calendar calendar = Calendar.getInstance(Locale.UK); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setMinimalDaysInFirstWeek(4); Date date = null; try { date = formatter.parse(src); } catch (ParseException e) { ... |