算一算你来到这个世界多少天了?
package practice;
import java.text.ParseException;
import java.text.SimpleDateFormat;import java.util.Date;
import java.util.Scanner;
public class P3 {
public static void main(String[] args) throws ParseException {Scanner sc=new Scanner(System.in);
System.out.println("输入你的出生时间:");
String line=sc.nextLine();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
Date d=sdf.parse(line);
long myTime=d.getTime();
long nowTime=System.currentTimeMillis();
long time=nowTime-myTime;
long day =time/1000/60/60/24;
System.out.println("你来到这个世界:"+day+"天");
}
}