How can I calculate the age at death?

Posted by user521180 on Stack Overflow See other posts from Stack Overflow or by user521180
Published on 2011-03-04T15:12:17Z Indexed on 2011/03/04 15:24 UTC
Read the original article Hit count: 160

Filed under:
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
if(petDetails.getDateOfDeath() != null){
    String  formatedDateOfDeath = formatter.format(petDetails.getDateOfDeath());
    String formateDateOfBirth = formatter.format(petDetails.getDateOfBirth());
}

How can i calculate the age of death from the above. I dont want to use any externallibraries

EDIT: please look at what I've got so far.none of the other threads are like mine. most of them are about date from DOB to today and not in the format im using.

© Stack Overflow or respective owner

Related posts about java