Java Age Calculate calculateAge(Date aBirthdate)

Here you can find the source of calculateAge(Date aBirthdate)

Description

FILLIN

License

Apache License

Parameter

Parameter Description
aBirthdate a parameter

Declaration

public static int calculateAge(Date aBirthdate) 

Method Source Code

//package com.java2s;
//   Licensed under the Apache License, Version 2.0 (the "License");

import java.util.Calendar;
import java.util.Date;

import java.util.Locale;

public class Main {
    /**/*from   ww  w  .  j  av  a  2  s  .co m*/
     * FILLIN
     * 
     * @param       aBirthdate
     * 
     * @return
     */
    public static int calculateAge(Date aBirthdate) {
        Calendar myAge = Calendar.getInstance(Locale.getDefault());
        myAge.setTimeInMillis(Math.abs(aBirthdate.getTime() - System.currentTimeMillis()));
        return myAge.get(Calendar.YEAR) - 1970;
    }
}

Related

  1. age(Date birthdate, Date asOf)
  2. age(Date dob)
  3. age(int year, int month, int date)
  4. ageAcceptable(final Date doB, final Date now, final int acceptedAge)
  5. ageInYears(java.util.Date dateUtil)
  6. calculateAge(Date aDateFrom, Date aDateTo)
  7. calculateAge(Date birthDate)
  8. calculateAge(Date birthday)
  9. calculateAge(Date dateOfBirth)