How to create a calendar object based on the current time plus a few seconds

I am wondering if I can get a new Calendar object based on the current time plus a given amount of time, say 5 minutes.

+4
source share
3 answers
Calendar c = Calendar.getInstance(); //gives u calendar with current time c.add(Calendar.MINUTE, 5); //add 5 minutes to calendar 
+11
source

Use the add function of the Calendar class to add and setTime(new Date()) to get the calendar based on the current time.

0
source

You need to use the c.set () methods to set the year, month, and date for the calendar object.

0
source

Source: https://habr.com/ru/post/1342079/


All Articles