当前日期-出生日期=活的天数

时间:2021-09-22 13:59:03
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import java.util.Scanner;

public class day {
public static void main (String[] arge) throws ParseException {
System.out.println("请输入你的破蛋日");
Scanner sc=new Scanner(System.in);
String date=sc.nextLine();
DateFormat df= DateFormat.getDateInstance();
long t1=df.parse(date).getTime();
long t2=new Date().getTime();
long day=(t2-t1)/1000/60/60/24;
System.out.println(day);

}
}