Java Calendar Year sameYear(Calendar one, Calendar two)

Here you can find the source of sameYear(Calendar one, Calendar two)

Description

Returns true if the two given calendars are dated on the same year.

License

Apache License

Parameter

Parameter Description
one The one calendar.
two The other calendar.

Return

True if the two given calendars are dated on the same year.

Declaration

public static boolean sameYear(Calendar one, Calendar two) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    /**/*from   w w  w .jav  a2  s.c  om*/
     * Returns <tt>true</tt> if the two given calendars are dated on the same year.
     * @param one The one calendar.
     * @param two The other calendar.
     * @return True if the two given calendars are dated on the same year.
     */
    public static boolean sameYear(Calendar one, Calendar two) {
        return one.get(Calendar.YEAR) == two.get(Calendar.YEAR);
    }
}

Related

  1. isSameDayOfYear(Calendar calendar1, Calendar calendar2)
  2. isSameWeekOfYear(Calendar calendar1, Calendar calendar2)
  3. isToThisDayOrLater(int year, int month, int day, java.util.Calendar start, java.util.Calendar end)
  4. isWithinYears(int year, java.util.Calendar start, java.util.Calendar end)
  5. parseCalendar(int year, int month, double day, TimeZone zone)
  6. setCalendarFields(Calendar cal, int year, int month, int day, int hour, int minute, int second, int millis)
  7. setDate(Calendar cal, int year, int month, int day)
  8. toCalendar(int year, int month, int day, int hour, int minutes, int seconds)
  9. toStringYearMonth(Calendar calendar)