Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Calendar.get(Calendar.MONTH) return 0? [duplicate]

Tags:

java

calendar

why does the following return 0?

int currMonth = c.get(Calendar.MONTH);
like image 457
dr85 Avatar asked Jan 14 '11 18:01

dr85


2 Answers

The Months are numbered from 0 (January) to 11 (December).

Reference:

  • Calendar.MONTH
like image 111
Sean Patrick Floyd Avatar answered Oct 21 '22 01:10

Sean Patrick Floyd


Not natural indexing, but unnatural thinking of Sun people. :-)

like image 24
Axel Fontaine Avatar answered Oct 21 '22 01:10

Axel Fontaine