Java Calendar Year getYear(Calendar calendar)

Here you can find the source of getYear(Calendar calendar)

Description

get Year

License

Open Source License

Parameter

Parameter Description
calendar a parameter

Return

int com o ano do Calendar passado

Declaration

public static int getYear(Calendar calendar) 

Method Source Code

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

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

public class Main {
    /**//from w ww.  j  av  a 2  s.  c o  m
     * @param calendar
     * @return int com o ano do Calendar passado
     */
    public static int getYear(Calendar calendar) {
        return calendar.get(Calendar.YEAR);
    }

    /**
     * @param data
     * @return int com o ano do Date passado
     */
    public static int getYear(Date data) {
        Calendar dataCal = Calendar.getInstance();
        dataCal.setTime(data);
        return dataCal.get(Calendar.YEAR);
    }
}

Related

  1. getWeekOfYear(Calendar currentDate)
  2. getWeekOfYear(int startDay, Calendar dt)
  3. getWeekOfYearYear(GregorianCalendar cal)
  4. getYear(Calendar cal)
  5. getYear(Calendar calendar)
  6. getYear(Calendar calendar)
  7. getYear(Date date, Calendar cal)
  8. getYearForWeek(final Calendar cal)
  9. getYearList(Calendar currDate)