Here you can find the source of getYear(long dateTimeMillis)
public static int getYear(long dateTimeMillis)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static int getYear(long dateTimeMillis) { SimpleDateFormat format = new SimpleDateFormat("yyyy"); StringBuilder dateString = new StringBuilder( format.format(dateTimeMillis)); return Integer.parseInt(dateString.toString()); }//from w w w.ja v a 2 s . c o m }