calendar.add(Calendar.YEAR, 1)
Calendar cal = Calendar.getInstance();Date today = cal.getTime();cal.add(Calendar.YEAR, 1); // to get previous year add -1Date nextYear = cal.getTime();
请注意,如果日期是,
29/Feb/2012并且您添加了1年,则将获得
28/Feb/2013
欢迎分享,转载请注明来源:内存溢出
calendar.add(Calendar.YEAR, 1)
Calendar cal = Calendar.getInstance();Date today = cal.getTime();cal.add(Calendar.YEAR, 1); // to get previous year add -1Date nextYear = cal.getTime();
请注意,如果日期是,
29/Feb/2012并且您添加了1年,则将获得
28/Feb/2013
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)