此Java代码是算出生到现在过了多少天
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class TestSimpleDateFormat {
public static void main(String[] args) throws ParseException {
System.out.println("请输入您生日日期,格式为:xxxx-xx-xx,例如:2000-01-01");
String sc = new Scanner(System.in).nextLine();
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
Date p = s.parse(sc);
long t1 = p.getTime();
long t2 = new Date().getTime();
long t4 = (t2-t1)/1000/60/60/24;
System.out.println("距离您出生经历了"+t4+"天");
}
}