Here you can find the source of getCurrentYear()
public static String getCurrentYear()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentYear() { return getFormatCurrentTime("yyyy"); }//from w w w .ja va2s. c om public static String getFormatCurrentTime(String format) { return getFormatDateTime(new Date(), format); } public static String getFormatDateTime(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }