List of utility methods to do Date Add
String | dateAddHours(Date time, int hours, SimpleDateFormat dateFormat) date Add Hours long timeLong = time.getTime() / 1000 + 60l * 60 * hours; time.setTime(timeLong * 1000); String timeStr = dateFormat.format(time); return timeStr; |
Date | dateAddMinutes(Date date, int minutes) date Add Minutes if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.MINUTE, minutes); return cal.getTime(); |
String | dateAddMM(Date date, int i) date Add MM Date currTime = addMM(date, i); SimpleDateFormat format = new SimpleDateFormat(DATETIME_FORMAT_YYYYMMDDHHMMSS); return format.format(currTime); |
Date | dateAddMonths(Date date, int addMonths) date Add Months if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.MONTH, addMonths); return cal.getTime(); |
Date | dateAddSpaceMilliSecond(Date date, int milliSecond) date Add Space Milli Second Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MILLISECOND, milliSecond);
return cal.getTime();
|