List of utility methods to do SQL Date Add
Date | add(Date date, int unit, int amount) add Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(unit, amount);
return c.getTime();
|
Date | addDate(int add, java.util.Date d) add Date return addDate(add, new Date(d.getTime())); |
java.util.Date | addDate(java.util.Date date, int day) add Date java.util.Calendar c = java.util.Calendar.getInstance(); c.setTimeInMillis(getMillis(date) + ((long) day) * 24 * 3600 * 1000); return c.getTime(); |
Date | addDate(String date) add Date if (date == null) { return null; Date tempDate = parseDate(C_DATE_PATTON_DEFAULT, date); String year = format(tempDate, "yyyy"); String month = format(tempDate, "MM"); String day = format(tempDate, "dd"); GregorianCalendar calendar = new GregorianCalendar(Integer.parseInt(year), Integer.parseInt(month) - 1, ... |
Date | addDays(Date date, int days) add Days return new Date(date.getTime() + 1000 * 60 * 60 * 24 * days); |
java.sql.Date | addDaysToSQLDate(java.sql.Date date, int days) add Days To SQL Date return new java.sql.Date(date.getTime() + (days * DAY_IN_MILLSEC)); |
Date | addMesData(Date dtReferencia, int mes) add Mes Data Calendar dtLimiteAux = Calendar.getInstance(); dtLimiteAux.setTimeInMillis(dtReferencia.getTime()); dtLimiteAux.add(Calendar.MONTH, mes); return new Date(dtLimiteAux.getTimeInMillis()); |
Date | addMilliseconds(Date date, int milliseconds) add Milliseconds return add(date, Calendar.MILLISECOND, milliseconds);
|
java.sql.Date | AddSqlDate(String strDate, int iDays) Add Sql Date DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date d1 = df.parse(strDate); return new java.sql.Date(AddDate(d1, iDays).getTime()); |
java.sql.Date | addYearsToDate(java.sql.Date date, int years) add Years To Date java.sql.Date logicalDate; Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.YEAR, years); return new java.sql.Date(c.getTimeInMillis()); |