Is it possible to subtract time from a calendar?
e.g.
.....
Calendar DueTime = Calendar.getInstance();
Calendar ReminderTime = Calendar.getInstance();
int ReminderMinute = 5;
DueTime.set(DueYear, DueMonth, DueDay, DueHour, DueMinute);
Day = Day - reminderDays ;
Day = Day - (Week*7) ;
Month = Month - reminderMonths ;
Year = Year - reminderYears ;
Hour = Hour - reminderHours ;
Minute= Minute- reminderMinutes;
ReminderTime.set(Year, Month, Day, Hour, Minute );
ReminderTime.add(Calendar.DAY_OF_MONTH , - Day );
ReminderTime.add(Calendar.MONTH , - Month );
ReminderTime.add(Calendar.YEAR , - Year );
ReminderTime.add(Calendar.HOUR , - Hour );
ReminderTime.add(Calendar.MINUTE , - Minute);
If the above is possible another question I would like to know is if...
reminderDays = 60;
Then would that go into the month before it as well?
Say its the 31st of the month that the due date is and the month before it has 30 days would the reminder day be the 1st of that month?
On another note that's related:
I'm not sure if I am right or not but does a calendar instance store time in milliseconds?
e.g. 1 minute would be 600 milliseconds and an hour would be 36000 milliseconds
So if I did:
ReminderTime.add(Calendar.HOUR , - 1 );
all it would be doing is adding -36000 to the total time stored in that calendar object
so if that's true would doing:
ReminderTime.add(Calendar.DAY_OF_MONTH , - 60 );
result in it subtracting 51840000 milliseconds? Or would I need to change
ReminderTime.add(Calendar.DAY_OF_MONTH , - 60 );
to
ReminderTime.add(Calendar.DAY_OF_YEAR , - 60 );
This would be after I call:
ReminderTime.set(Year, Month, Day, Hour, Minute );
What I expect from this above is that my activity will calculate which day of the year that calendar object is and remove 51840000 milliseconds from it.
Can anyone help?
Three different questions here, separated by lines