JAVA 获取当前日期和下一天

Date date = new Date(System.currentTimeMillis());
SimpleDateFormat dateFormat = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);
dateFormat.setTimeZone(TimeZone.getTimeZone(“GMT+8”));
String time = dateFormat.format(date);
Calendar c = Calendar.getInstance();
Date nowDate = new SimpleDateFormat(“yy-MM-dd”).parse(time);;
c.setTime(nowDate);
c.set(Calendar.DATE, c.get(Calendar.DATE) + 1);
String time2 = new SimpleDateFormat(“yyyy-MM-dd”).format(c.getTime());
System.err.println(time + " —" + time2);

你可能感兴趣的:(java)