This can be achieved using java.util.Date
. The following code will subtract 1 hour from your date.
Date date = new Date(yourdate in date format);
Date newDate = DateUtils.addHours(date, -1)
Similarly for subtracting 20 seconds from your date
newDate = DateUtils.addSeconds(date, -20)