java calendar add minutes

Solutions on MaxInterview for java calendar add minutes by the best coders in the world

showing results for - "java calendar add minutes"
Ren
20 Mar 2020
1 String myTime = "14:10";
2 SimpleDateFormat df = new SimpleDateFormat("HH:mm");
3 Date d = df.parse(myTime); 
4 Calendar cal = Calendar.getInstance();
5 cal.setTime(d);
6 cal.add(Calendar.MINUTE, 10);
7 String newTime = df.format(cal.getTime());