Get the current date, year, month, day, hour and minute

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
Date date = new Date(System.currentTimeMillis());
String time = simpleDateFormat.format(date);
int year = Integer.parseInt(time.substring(0, 4));
int month = Integer.parseInt(time.substring(5, 7));
int day = Integer.parseInt(time.substring(8, 10));
int hour = Integer.parseInt(time.substring(12, 14));
int minute = Integer.parseInt(time.substring(15, 17));

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324734919&siteId=291194637