Here you can find the source of getYear(String dateTime)
public static int getYear(String dateTime)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static int getYear(String dateTime) { Calendar c = Calendar.getInstance(); c.setTime(getDateTime(dateTime)); int year = c.get(1); return year; }/*from w w w . j a v a2s. com*/ public static java.util.Date getDateTime(String dateTime) { java.util.Date strDate = java.sql.Date.valueOf(dateTime); return strDate; } }