getActualMaximum function returns the non-existent value in kotlin

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
newest oldest most voted
Notify of

The java.util.Calendar class is notoriously difficult to use, so much so that Joda-Time was independently developed and then officially adapted/adopted into the java.time package (with some small modifications from the original developer). Here, the problem you have with Calendar is that JANUARY is a constant 0. So, when you use a 6 for Calendar.MONTH that is JULY. There are 31 days in July 2020. Don’t use the Calendar class if you can avoid it. The java.time API is far more consistent. If you can’t avoid using Calendar, use the provided constants – for example, it.set(Calendar.MONTH, Calendar.JUNE) But, even if you’re… Read more »