月份加一不加一,听的有点晕,忘解释一下
月份加一不加一,听的有点晕,忘解释一下
如这段代码的月份
cal=Calendar.getInstance();
//获取年月日,时分
year=cal.get(cal.YEAR);
month=cal.get(cal.MONTH)+1;//这里月份从0开始计
day=cal.get(cal.DAY_OF_MONTH);
hour=cal.get(cal.HOUR_OF_DAY);
minute=cal.get(cal.MINUTE);
setTitle(year+"-"+cal.get(cal.MONTH)+"-"+day+" "+hour+":"+minute);//这里不加一???为什么