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