Java Date to Year getYear(Date d)

Here you can find the source of getYear(Date d)

Description

get Year

License

Open Source License

Declaration

public static int getYear(Date d) 

Method Source Code

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

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

public class Main {

    public static int getYear(Date d) {

        Calendar c = Calendar.getInstance();
        c.setTime(d);/*from ww w . ja va 2s  . c o  m*/
        return c.get(Calendar.YEAR);
    }

    public static int getYear() {
        return getYear(new Date());
    }
}

Related

  1. getYear(Date aDate)
  2. getYear(Date d)
  3. getYear(Date d)
  4. getYear(Date date)
  5. getYear(Date date)
  6. getYear(Date date)