user496949
user496949

Reputation: 86135

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

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

Upvotes: 4

Views: 15391

Answers (3)

Loki
Loki

Reputation: 49

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

Upvotes: 0

Suraj Chandran
Suraj Chandran

Reputation: 24791

Calendar c = Calendar.getInstance(); //gives u calendar with current time
c.add(Calendar.MINUTE, 5); //add 5 minutes to calendar

Upvotes: 13

Sergey Vedernikov
Sergey Vedernikov

Reputation: 7754

Use add function of Calendar class for adding and setTime(new Date()) for getting calendar based on current time.

Upvotes: 0

Related Questions