date manipulation  [ 611 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

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }