Java Utililty Methods Date to Year

List of utility methods to do Date to Year

Description

The list of methods to do Date to Year are organized into topic(s).

Method

StringgetYearString(Date date)
returns the four digit year as a string or an empty string if the date is null
String yearString = "";
if (date != null) {
    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(date);
    yearString = cal.get(Calendar.YEAR) + "";
return yearString;