get Years from timestamp - Android java.util

Android examples for java.util:Date Timestamp

Description

get Years from timestamp

Demo Code


//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
}

Related Tutorials