c1.get(Calendar.MONTH)中月份少一个月本来是8月的,但是它却现实7月,为什么

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/28 19:24:35

c1.get(Calendar.MONTH)中月份少一个月
本来是8月的,但是它却现实7月,为什么

请读API,实现就是如此,正常的.
另外 - 如果我的猜测是真的 - 显示日期最好用java.text.SimpleDateFormat.
String out = new SimpleDateFormat("yyyyMMdd").format(Calendar.getInstance().getTime())