java android日历月从0开始
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10529102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
android calendar month begin at 0
提问by Sam
Possible Duplicate:
Why is January month 0 in Java Calendar?
可能的重复:
为什么 Java 日历中的 1 月是 0?
It seems that calendar in android makes month begins from 0. Why should it be designed like this?
android中的日历好像是从0开始的,为什么要这样设计呢?
final Calendar c = Calendar.getInstance();
mMonth = c.get(Calendar.MONTH);
Today, the mMonth is 4.
今天,mMonth 是 4。
回答by sachin garg
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?
这不是由 Android 开发人员完成的。这就是它在java.util.Calendar
. 如果您想知道 Java 开发人员为什么这样设计,请查看此线程。
为什么 Java 日历中的 1 月是 0?