标签:void system.in tar tee rac port method exception next
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class demo3 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("请输入第一个日期:yyyy-MM-dd");
Scanner s = new Scanner(System.in);
String strDateStar = s.next();
System.out.println("请输入第二个日期:yyyy-MM-dd");
Scanner s1 = new Scanner(System.in);
String strDateEnd = s.next();
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date dateStart = sdf.parse(strDateStar );
Date dateEnd = sdf.parse(strDateEnd );
System.out.println((dateEnd.getTime() - dateStart.getTime())/86400000/7);
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
标签:void system.in tar tee rac port method exception next
原文地址:http://www.cnblogs.com/xibeifeng/p/6107152.html