Opposite of subtracting seconds from a java date, this example will show how to add seconds to a date using Calendar.add, java 8 date time api, joda DateTime.plusSeconds and apache common DateUtils.addSeconds. In the examples below, we will set a date that represents new years eve, December 31st, then add seconds to return a date representing new years day or January 1st.
Straight up Java
Output
Java 8 Date and Time API
Java 8 LocalDateTime.plusSeconds will return a copy of the LocalDateTime with the specified number of seconds added.
Output
Joda Time
Joda DateTime.plusSeconds will return a copy the DateTime plus the specified number of seconds.
Output
Apache Commons
Apache commons DateUtils.addSeconds will adds a number of seconds to the date returning a new object.