Java Date to Year getYearOfThisYear(Date currentdate)

Here you can find the source of getYearOfThisYear(Date currentdate)

Description

get Year Of This Year

License

Apache License

Declaration

public static int getYearOfThisYear(Date currentdate) 

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 getYearOfThisYear(Date currentdate) {
        Calendar cal = Calendar.getInstance();
        if (currentdate != null) {
            cal.setTime(currentdate);//from  w  w w .j av  a 2s .  co  m
        } else {
            cal.setTime(new Date());
        }
        return cal.get(Calendar.YEAR);
    }
}

Related

  1. getYearMonthDay(Date date)
  2. getYearMonthInt(Date date)
  3. getYearMonthOfLastMon(Date date)
  4. getYearNumber(Date date)
  5. getYearOfDate(Date date)
  6. getYearOnlyDate(String year)
  7. getYears(java.util.Date date0, java.util.Date date1)
  8. getYearStart(Date date)
  9. getYearString(Date date)