So I’m working on a new Android app and was having a small problem with the Date Picker widget. My datepicker.getMonth() kept returning incorrectly. What was the problem? The month is zero-based.
“year — The initial year.
monthOfYear — The initial month starting from zero.
dayOfMonth — The initial day of the month.”
So for my application, I have to call getMonth()+1 every time. I thought this was odd, but I found a comment on Stack Overflow that pointed out that if you had an array of months, you’d want the array value to match up with the month. Interesting