您的位置:首页 > 其它

The method getYear() from the type Date is deprecated

2016-07-08 16:47 826 查看
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。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: