Here you can find the source of getCurrentYear()
public static String getCurrentYear()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentYear() { return getFormatCurrentTime("yyyy"); }/* w w w. j a v a2s. co m*/ 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); } }