Android examples for java.util:Date Timestamp
get Years from timestamp
//package com.java2s; import java.util.Calendar; public class Main { public static int getYears(long timeStamp) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis() - timeStamp); return calendar.get(Calendar.YEAR) - 1970; }//from w w w . j ava 2 s.c o m }