GregorianCalendar 日期操作

GregorianCalendar gc = new GregorianCalendar();
		int mon  = gc.get(Calendar.MONTH);
		int day = gc.get(Calendar.DAY_OF_MONTH);
		int year = gc.get(Calendar.YEAR);
		
		System.out.println(mon);
		System.out.println(day);
		System.out.println(year);
		
		System.out.println(gc.get(Calendar.DAY_OF_WEEK));
		gc.set(Calendar.MONDAY, Calendar.DECEMBER);
		int mon1 = gc.get(Calendar.MONTH);
		System.out.println(mon1);
	

 结果

0
5
2012
5
11

你可能感兴趣的:(calendar)