注意使用Date获取当前年月日会出现一些问题,一般选择Calendar获取
Calendar calendar = Calendar.getInstance();
int
year = calendar.get(Calendar.YEAR);
int
month = calendar.get(Calendar.MONTH) +
1
;
int
day = calendar.get(Calendar.DAY_OF_MONTH);
int
hour = calendar.get(Calendar.HOUR_OF_DAY);
int
minute = calendar.get(Calendar.MINUTE);
int
millisecond = calendar.get(Calendar.SECOND);
樱花和代码皆我最爱