Android examples for java.util:Date Algorithm
get Age From Date
import java.util.Calendar; public class Main{ public static int getAgeFromDate(long birthDate) { long msYear = 1000L * 60 * 60 * 24 * 365; int years = (int) ((getUnixTime() - birthDate) / msYear); return years; }/*from w w w.j a v a2 s .c om*/ public static long getUnixTime() { return Calendar.getInstance().getTime().getTime(); } }