Here you can find the source of calculateAge(Date aBirthdate)
Parameter | Description |
---|---|
aBirthdate | a parameter |
public static int calculateAge(Date aBirthdate)
//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; } }