Here you can find the source of getYear()
public static String getYear()
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String getYear() { GregorianCalendar calendar = new GregorianCalendar(); String year = new Integer(calendar.get(GregorianCalendar.YEAR)).toString(); return year; }/* ww w. java 2 s . c o m*/ }