Java Utililty Methods Date to Year

List of utility methods to do Date to Year

Description

The list of methods to do Date to Year are organized into topic(s).

Method

intgetYear(Date date)
Retrieve a year of a full date
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
return year;
intgetYear(Date date)
get Year
return newCalendar(date).get(Calendar.YEAR);
intgetYear(Date date)
get Year
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(1);
intgetYear(Date date)
Returns a int value indicating the year.
return parseDateToCalendar(date).get(Calendar.YEAR);
IntegergetYear(Date date)
get Year
Calendar c = getCalendar();
c.setTime(date);
return c.get(Calendar.YEAR);
intgetYear(Date dateParam)
get Year
if (dateParam == null) {
    throw new IllegalArgumentException("The dateParam  must not be null");
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(dateParam.getTime());
return cal.get(Calendar.YEAR);
intgetYear(Date start)
get Year
Calendar c = Calendar.getInstance();
c.setTime(start);
Calendar now = Calendar.getInstance();
int count = 0;
for (;;) {
    c.add(Calendar.YEAR, 1);
    count++;
    if (c.after(now)) {
...
intgetYear(final Date date)
Returns the calendar year given a date
final GregorianCalendar c = gregorianCalendarThreadLocal.get();
c.setTime(date);
return c.get(Calendar.YEAR);
intgetYear(final Date date)
get Year
final Calendar calendar = GregorianCalendar.getInstance();
calendar.clear();
calendar.setTime(date);
return calendar.get(Calendar.YEAR);
intgetYear(final Date date)
Get the year by given date.
return getNumberOfGranularity(Calendar.YEAR, date);