Answers for "adding hours in calendar java error"

1

java Calendar add time

Calendar calendar = Calendar.getInstance();  
// 15 days ago
calendar.add(Calendar.DATE, -15); 
// After 4 months
calendar.add(Calendar.MONTH, 4);
Posted by: Guest on August-28-2020
0

java calendar add minutes

String myTime = "14:10";
 SimpleDateFormat df = new SimpleDateFormat("HH:mm");
 Date d = df.parse(myTime); 
 Calendar cal = Calendar.getInstance();
 cal.setTime(d);
 cal.add(Calendar.MINUTE, 10);
 String newTime = df.format(cal.getTime());
Posted by: Guest on April-15-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language