【发布时间】:2011-03-04 15:12:17
【问题描述】:
可能的重复:
How can I calculate the age of a person in year, month, days?
How can I calculate the difference between two dates
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
if(petDetails.getDateOfDeath() != null){
String formatedDateOfDeath = formatter.format(petDetails.getDateOfDeath());
String formateDateOfBirth = formatter.format(petDetails.getDateOfBirth());
}
我如何从上面计算死亡年龄。我不想使用任何外部库
编辑:请看看我到目前为止所得到的。其他线程都不像我的。其中大多数是关于从出生日期到今天的日期,而不是我使用的格式。
【问题讨论】:
-
一个小时前他上一个问题的可能重复:stackoverflow.com/questions/5194216/…
标签: java