Here you can find the source of GetYear(String agmipDate)
public static String GetYear(String agmipDate) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final SimpleDateFormat apsim = new SimpleDateFormat("dd/MM/yyyy"); public static String GetYear(String agmipDate) throws ParseException { Date date = apsim.parse(agmipDate); Calendar c = Calendar.getInstance(); c.setTime(date);/* w ww.ja v a 2 s. c o m*/ return c.get(Calendar.YEAR) + ""; } }