Date date = new Date();
// date.getYear(); //已过期
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH) + 1;
int day = cal.get(Calendar.DAY_OF_MONTH);
System.out.println(year + "-" + month + "-" + day);
Java处理Date的过期函数getYear()等
最新推荐文章于 2024-07-15 03:21:09 发布