Java Date to Year getYear(Date date)

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

Description

get Year

License

Open Source License

Declaration

public static final int getYear(Date date) 

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 final int getYear(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);/*  w  w w .  j  av  a 2  s.  c o  m*/
        return calendar.get(1);
    }

    public static final int getYear(long millis) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(millis);
        return calendar.get(1);
    }
}

Related

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