public class Demo02 {
public static void main(String[] args) {
Calendar me = Calendar.getInstance(); //我
Calendar now = Calendar.getInstance();
me.set(1995, 5, 22);
//获取出生到现在的毫秒值
long chusheng = me.getTimeInMillis();
long today = now.getTimeInMillis();
//获取一天多少秒
long day = 1000*60*60*24;
long tian = (today-chusheng)/day;
System.out.println("我已经活了"+tian);
}
}
OVER!!!
|
|