Java Utililty Methods Second Add

List of utility methods to do Second Add

Description

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

Method

DateaddOrMinusSecond(long ti, int i)
add Or Minus Second
Date rtn = null;
GregorianCalendar cal = new GregorianCalendar();
Date date = new Date(ti);
cal.setTime(date);
cal.add(Calendar.SECOND, i);
rtn = cal.getTime();
return rtn;
DateaddSecond(Date date, int n)
add Second
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.SECOND, n);
return cal.getTime();
DateaddSecond(Date date, int number)
add Second
Calendar calendar = getDefaultCalendar();
calendar.setTime(date);
calendar.add(Calendar.SECOND, number);
return calendar.getTime();
DateaddSecond(Date date, int numberOfSecond)
add Second
if (numberOfSecond == 0) {
    return date;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.SECOND, numberOfSecond);
date = cal.getTime();
return date;
...
DateaddSecond(Date date, int second)
Adds given second(s) to the given date
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.SECOND, second);
return calendar.getTime();
DateaddSecond(Date source, int s)
add Second
Calendar cal = Calendar.getInstance();
cal.setTime(source);
cal.add(Calendar.SECOND, s);
return cal.getTime();
DateaddSecond(int second)
add Second
return addTime(Calendar.SECOND, second);
DateaddSeconds(Date date, int seconds)
add seconds to a date
final Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.SECOND, seconds);
return c.getTime();
DateaddSeconds(Date date, int seconds)
Creates a new date as a clone of the specified date and adds the specified number of seconds to it.
Date newDate = (Date) date.clone();
Calendar cal = Calendar.getInstance();
cal.setLenient(true);
cal.setTime(newDate);
cal.add(Calendar.SECOND, seconds);
return cal.getTime();
DateaddSeconds(final Date date, final int seconds)
add Seconds
final Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.SECOND, seconds);
final Date end = c.getTime();
return end;