Java Date to Year getYear(Date aDate)

Here you can find the source of getYear(Date aDate)

Description

get Year

License

Open Source License

Declaration

public static Integer getYear(Date aDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {

    public static Integer getYear(Date aDate) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(aDate);/*from   w ww.  j a v a  2s.  c  o  m*/
        return new Integer(cal.get(Calendar.YEAR));
    }

    public static int getYear(int rcYear) {
        return rcYear + 1911;
    }

    public static Integer getYear(Integer rcYear) {
        return new Integer(getYear(rcYear.intValue()));
    }
}

Related

  1. getYear(Date d)
  2. getYear(Date d)
  3. getYear(Date d)
  4. getYear(Date date)