方式一:
Calendar calendar = Calendar.getInstance();
System.out.println(calendar.get(Calendar.YEAR));
System.out.println(calendar.get(Calendar.MONTH+1));
System.out.println(calendar.get(Calendar.DATE));
方式二:
String[] strNow = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString().split("-");
Integer year = Integer.parseInt(strNow[0]);
Integer month = Integer.parseInt(strNow[1]);
Integer day = Integer.parseInt(strNow[2]);