package test;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public
class
T {
public
static
void
main(String[] args) {
Date date =
new
Date();
System.
out
.println((
new
SimpleDateFormat(
"yyyy-MM-dd"
)).format(date));
Calendar cal = Calendar.getInstance();
cal.setTime(date);
//加天
cal.add(Calendar.DATE, 100);
System.
out
.println((
new
SimpleDateFormat(
"yyyy-MM-dd"
)).format(cal.getTime()));
//减天
cal.add(Calendar.DATE, -100);
System.
out
.println((
new
SimpleDateFormat(
"yyyy-MM-dd"
)).format(cal.getTime()));
}
}