Java Year Current getYear()

Here you can find the source of getYear()

Description

get Year

License

Apache License

Declaration

public static int getYear() 

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 getYear() {
        return getYear(now());
    }/*w w w  .j  a  v a 2  s.  c  o  m*/

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

    /**
     * @return the current moment
     */
    public static Date now() {
        return new Date();
    }
}

Related

  1. getCurrentYearMonth()
  2. getCurrentYearMonthDay()
  3. getCurrYear()
  4. getCurrYearFirst()
  5. getLastDayOfCurrentYear()
  6. getYear()
  7. getYear()
  8. getYear()
  9. getYear()