当前位置: 技术问答>java相关
关于calendar的问题
来源: 互联网 发布时间:2015-10-04
本文导语: 我想用calendar取出年份和日月: Calendar now = Calendar.getInstance(); int month_now = now.MONTH; int month_year = now.YEAR; 为什么取出来的却是: month_now == 2 ? month_year == 2 ? 怎么样才能够取出年份和月份? ...
我想用calendar取出年份和日月:
Calendar now = Calendar.getInstance();
int month_now = now.MONTH;
int month_year = now.YEAR;
为什么取出来的却是:
month_now == 2 ?
month_year == 2 ?
怎么样才能够取出年份和月份?
Calendar now = Calendar.getInstance();
int month_now = now.MONTH;
int month_year = now.YEAR;
为什么取出来的却是:
month_now == 2 ?
month_year == 2 ?
怎么样才能够取出年份和月份?
|
忘了月份要加上1
1 + now.get(Calendar.MONTH)
1 + now.get(Calendar.MONTH)