获取系统年月日

//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//Date d = sdf.parse("2011-10-20");
Calendar c = Calendar.getInstance();
//c.setTime(d);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
int day = c.get(Calendar.DAY_OF_MONTH);
System.out.printf("year=%04d, month=%02d, day=%02d
", year, month, day);

原文地址:https://www.cnblogs.com/archermeng/p/7537346.html