Here you can find the source of getYearFromTimestamp(long ms)
public static int getYearFromTimestamp(long ms) throws NumberFormatException
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; public class Main { public static final TimeZone TIMEZONE = TimeZone.getTimeZone("UTC"); public static final Locale LOCALE = new Locale("sv", "SE"); public static int getYearFromTimestamp(long ms) throws NumberFormatException { if (ms < 0) throw new NumberFormatException("argument must be positive"); Calendar cal = Calendar.getInstance(TIMEZONE, LOCALE); cal.setTimeInMillis(ms);//from w w w . j a va 2s . co m return cal.get(Calendar.YEAR); } }