标签:
package riqi;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class riqi_2 {
public static void main(String[] args) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Calendar c=Calendar.getInstance();
String str=df.format(new Date());
long to=0;
long from=0;
try {
to=df.parse(str).getTime();
from = df.parse("2018-9-7").getTime();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println((from-to) / (1000 * 60 * 60 * 24));
}
}
标签:
原文地址:http://www.cnblogs.com/BlogRegisterboby/p/5701343.html