package ch07_11;
import java.util.Calendar;
public class CalendarTest {
	public static void main(String[] args) {
		//获得当前日期对象
		Calendar calendar = Calendar.getInstance();
		// 利用calendar对象输出当前日期
		System.out.println("当前时间：" + calendar.getTime());
		System.out.println("当前年份：" + calendar.get(Calendar.YEAR));
		System.out.println("当前月：" + calendar.get(Calendar.MONTH));
		System.out.println("当前日期：" + calendar.get(Calendar.DATE));
		System.out.println("当前小时：" + calendar.get(Calendar.HOUR));
		System.out.println("当前小时(12进制)：" + calendar.get(Calendar.HOUR));
		String out="当前小时(24进制)：";
		System.out.println(+ calendar.get(out+Calendar.HOUR_OF_DAY));
		System.out.println("当前星期：" + calendar.get(Calendar.DAY_OF_WEEK));
	}
}