获取系统的时间并解析
Calendar rightNow = Calendar.getInstance();
Integer year = rightNow.get(Calendar.YEAR);
Integer month = rightNow.get(Calendar.MONTH) + 1;
Integer day = rightNow.get(rightNow.DAY_OF_MONTH);
时间格式字符串转为时间(date)
SimpleDateFormat mm1 = new SimpleDateFormat("yyyy-MM-dd");
Date parse = mm1.parse(dateTime);
SimpleDateFormat y1 = new SimpleDateFormat("yyyy");
int year = Integer.parseInt(y1.format(parse));
SimpleDateFormat m1 = new SimpleDateFormat("MM");
int m = Integer.parseInt(m1.format(parse));
SimpleDateFormat d1 = new SimpleDateFormat("dd");
int d = Integer.parseInt(d1.format(parse));
时间类型转为字符串类型
Date date=new Date();
SimpleDateFormat mm1 = new SimpleDateFormat("yyyy-MM-dd");
String format = mm1.format(date);