The method getYear() from the type Date is deprecated
Date date =new Date();
date.getYear();方法已过期
从 JDK 1.1 开始,由 Calendar.get(Calendar.YEAR) - 1900 取代。
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR);
与date.getMonth()一样,c.get(Calendar.MONTH)也需要加1。