Here you can find the source of getYear(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static int getYear(Calendar calendar)
//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); } }