import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class BirthDay {
public static void main(String[] args) throws ParseException {
//将生日的字符串转为代码
SimpleDateFormat da=new SimpleDateFormat("yyyy-MM-dd");
Date birth=da.parse("1995-08-27");
//把日期对象转为对应的毫秒值
System.out.println(birth);
long birthTime=birth.getTime();
//获取当前系统的毫秒值
long now=System.currentTimeMillis();
//当前系统毫秒值减去生日毫秒值,即为已活毫秒值
long liveTime=now-birthTime;
//将毫秒值转为天
long day=liveTime/1000/60/60/24;
//输出天数
System.out.println("活了"+day+"天");
}
}