package com.ruoyi.common.sms;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class CalculateDay {
public static void main(String[] args) {
int num = 30; //增加天数
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String fmt = format.format(date);
System.out.println("现在的日期是:" + fmt);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, num);// num为增加的天数,可以改变的
date = calendar.getTime();
String enddate = format.format(date);
System.out.println("增加天数以后的日期:" + enddate);
}
}