Java Year Get getYear()

Here you can find the source of getYear()

Description

get Year

License

LGPL

Declaration

public static int getYear() 

Method Source Code

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

import java.util.*;

public class Main {
    /**//from w w  w  . ja  v a2 s . c o  m
     * Year=1 *
     */
    public static final int YEAR = Calendar.YEAR;

    public static int getYear() {
        Calendar calendar = Calendar.getInstance();
        return calendar.get(Calendar.YEAR);
    }

    public static int getYear(final Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar.get(Calendar.YEAR);
    }
}

Related

  1. getYear()
  2. getYear()
  3. getYear()
  4. getYear()
  5. getYear()
  6. getYear()
  7. getYear(Date d)
  8. getYear(Date date)
  9. getYear(Date date)