android calendar month begin at 0 [duplicate]

2019-06-27 17:27发布

问题:

Possible Duplicate:
Why is January month 0 in Java Calendar?

It seems that calendar in android makes month begins from 0. Why should it be designed like this?

final Calendar c = Calendar.getInstance();
mMonth = c.get(Calendar.MONTH);

Today, the mMonth is 4.

回答1:

This was not done by the Android developers. This is how it works in java.util.Calendar. If you want to know why the Java developers designed it this way, please go through this thread. Why is January month 0 in Java Calendar?



标签: java calendar