Java Calendar.get(Calendar.MONTH) returns 0

Hello Everyone,
Today we are going to look into some weird stuff of JAVA which many of you might have faced if you work on something related to Dates.

As we know, Every Month has there unique number associated with them for e.g. JANUARY-01,FEBRUARY-02,MARCH-03…. but in JAVA that is not the case, in Java the months start with 0 i.e JAN -00,FEB-01…
Hence, when you do Calendar.get(Calendar.MONTH) for the current month of JAN then you will get 0.
Now this still seems to be a mystery that why the creators of calendar API used this kind of number format.
Anyways,to overcome this problem you just need to add 1 to your query
Calendar.get(Calendar.MONTH)+1 or you can add 1 to your variable,its upto you how you would want to do it.

Reference:

Calendar.MONTH