当前位置: 技术问答>java相关
Calendar问题,为什么月份总是少一个月?
来源: 互联网 发布时间:2014-12-26
本文导语: 我要取当前年月日,用Calendar , Calendar rightNow = Calendar.getInstance(); int iYear= rightNow.get(Calendar.YEAR); int iMonth= rightNow.get(Calendar.MONTH); int iDay= rightNow.get(Calendar.DAY_OF_MONTH ); 结果,发现,月份总是少一个月,一...
我要取当前年月日,用Calendar ,
Calendar rightNow = Calendar.getInstance();
int iYear= rightNow.get(Calendar.YEAR);
int iMonth= rightNow.get(Calendar.MONTH);
int iDay= rightNow.get(Calendar.DAY_OF_MONTH );
结果,发现,月份总是少一个月,一月为0,...
不知为何,bug?
Calendar rightNow = Calendar.getInstance();
int iYear= rightNow.get(Calendar.YEAR);
int iMonth= rightNow.get(Calendar.MONTH);
int iDay= rightNow.get(Calendar.DAY_OF_MONTH );
结果,发现,月份总是少一个月,一月为0,...
不知为何,bug?
|
注意:月份是 0 --- 11的