I am setting a Calendar day of month with an int value but when I check the value again the day of month from the created calendar it is 1 more than I set it to. And I am not sure why?
Here is an example:
System.out.println("DEBUG: Reminder day of month = " + reminder.getReminderDayofMonth());
calendar.set(Calendar.YEAR, reminder.getReminderYear());
calendar.set(Calendar.MONTH, reminder.getReminderMonth());
calendar.set(Calendar.DAY_OF_MONTH, reminder.getReminderDayofMonth());
calendar.set(Calendar.HOUR, reminder.getReminderHour());
calendar.set(Calendar.MINUTE, reminder.getReminderMinute());
System.out.println("DEBUG: Calendar day of month = " + calendar.get(Calendar.DAY_OF_MONTH));
I did the println so you can see the value in and the value out. I would expect that calling calander.get(Calander.DAY_OF_MONTH)
would return the same value as I put into it. But it doesn't, I get:
DEBUG: Reminder day of month = 18
DEBUG: Calendar day of month = 19
I am sure it is probably something simple but I have no idea why they would be different and I can't find anything in the docs to explain the discrepancy
What is the problem?
Thanks for your help