Calendar: 日历类
1.没有构造器,因为Calendar类是abstract的,无法通过new实例
只能通过getInstance()方法:获取实例;或者通过Calendar 的子类 GregorianCalendar 获取实例
静态方法:
public static Calendar getInstance() :使用默认时区和语言环境获得一个日历子类的对象。
常用方法:
public int get(int field) :返回给定日历字段的值。
public void set(int field, int
value) :将给定的日历字段设置为给定值。
public abstract void add(int field, int amount):根据日历的规则,为给定的日历字段添加或减去指 定的时间量。
public Date getTime():返回一个表示此Calendar时间值(从历元到现在的毫秒偏移量)的Date对象。
常用字段
Calendar类中提供很多静态的成员常量,代表给定的日历字段:

方法、字段举例
Calendar cal = Calendar.getInstance();
cal.get(Calendar.DATE);//-----------------------当天 1-31
cal.get(Calendar.DAY_OF_MONTH);//---------------当天 1-31
cal.get(Calendar.DAY_OF_WEEK);//----------------从星期天开始计算,如果今天星期二,那么返回3
cal.get(Calendar.DAY_OF_YEAR);//----------------
cal.get(Calendar.HOUR);//-----------------------12小时制
cal.get(Calendar.HOUR_OF_DAY);//----------------24小时制,一般使用这个属性赋值
cal.get(Calendar.MILLISECOND);//----------------
cal.get(Calendar.MINUTE);//---------------------
cal.get(Calendar.SECOND);//---------------------
cal.get(Calendar.WEEK_OF_MONTH);//--------------
cal.get(Calendar.WEEK_OF_YEAR);//---------------
cal.get(Calendar.MONTH);//-----------------------月份获取需要 +1,那么,赋值时需要 -1