Java Date to Year getYear(Date date)

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

Description

get Year

License

Apache License

Declaration

public static Integer getYear(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static int FIRST_DAY_OF_WEEK = Calendar.MONDAY;

    public static Integer getYear(Date date) {
        Calendar c = getCalendar();
        c.setTime(date);/*from  w w w .j  av a 2  s . c o  m*/
        return c.get(Calendar.YEAR);
    }

    private static Calendar getCalendar() {
        Calendar c = Calendar.getInstance();
        c.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        return c;
    }
}

Related

  1. getYear(Date date)
  2. getYear(Date date)
  3. getYear(Date date)
  4. getYear(Date date)
  5. getYear(Date date)
  6. getYear(Date dateParam)
  7. getYear(Date start)
  8. getYear(final Date date)
  9. getYear(final Date date)