Here you can find the source of toNowYear(Date date)
public static String toNowYear(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String toNowYear(Date date) { String strDate = ""; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy"); strDate = dateFormat.format(date); return strDate; }/* ww w . j a va 2 s . co m*/ }