date manipulation [ 755 views ]
Goal: sometimes we need to modify a date…
Like in this simple case. Let’s add 5 minutes to the actual time. Easy with the java.util.Calendar class.
Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, 5); System.out.println("The modified Date Time : " + cal.getTime());
Nota bene: this class can use years, hours, minutes… as well