Lines Matching defs:year

70  * and the Julian calendar is the leap year rule. The Julian calendar specifies
82 * leap year rules were applied irregularly, and before 45 BC the Julian
95 * calendar year is the earliest seven day period starting on {@link
98 * getMinimalDaysInFirstWeek()} days from that year. It thus depends
101 * between week 1 of one year and week 1 of the following year
103 * for year(s) involved in the Julian-Gregorian transition).
117 * <p>A <a name="week_year"><em>week year</em></a> is in sync with a
119 * weeks (inclusive) have the same <em>week year</em> value.
120 * Therefore, the first and last days of a week year may have
121 * different calendar year values.
127 * on January 4, 1998. The week year is 1998 for the last three days
128 * of calendar year 1997. If, however, {@code getFirstDayOfWeek()} is
131 * part of week 53 of 1997 and their week year is 1997.
140 * week 1 of a year, week 1 of a month may be shorter than 7 days, need
334 * epochs which are used are January 1, year 1 (Gregorian), which is day 1
335 * of the Gregorian calendar, and December 30, year 0 (Gregorian), which is
346 * 4-year leap year rule, even though the historical pattern of
532 * The normalized year of the gregorianCutover in Gregorian, with
538 * The normalized year of the gregorianCutover in Julian, with 0
628 * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
633 public GregorianCalendar(int year, int month, int dayOfMonth) {
634 this(year, month, dayOfMonth, 0, 0, 0, 0);
641 * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
650 public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay,
652 this(year, month, dayOfMonth, hourOfDay, minute, 0, 0);
659 * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
670 public GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay,
672 this(year, month, dayOfMonth, hourOfDay, minute, second, 0);
679 * @param year the value used to set the <code>YEAR</code> calendar field in the calendar.
691 GregorianCalendar(int year, int month, int dayOfMonth,
695 this.set(YEAR, year);
765 // Set the cutover year (in the Gregorian year numbering)
793 * Determines if the given year is a leap year. Returns <code>true</code> if
794 * the given year is a leap year. To specify BC year numbers,
795 * <code>1 - year number</code> must be given. For example, year BC 4 is
798 * @param year the given year.
799 * @return <code>true</code> if the given year is a leap year; <code>false</code> otherwise.
801 public boolean isLeapYear(int year) {
802 if ((year & 3) != 0) {
806 if (year > gregorianCutoverYear) {
807 return (year%100 != 0) || (year%400 == 0); // Gregorian
809 if (year < gregorianCutoverYearJulian) {
813 // If the given year is the Gregorian cutover year, we need to
814 // determine which calendar system to be applied to February in the year.
819 gregorian = year == gregorianCutoverYear;
821 return gregorian ? (year%100 != 0) || (year%400 == 0) : true;
894 int year = internalGet(YEAR);
896 year += amount;
897 if (year > 0) {
898 set(YEAR, year);
899 } else { // year <= 0
900 set(YEAR, 1 - year);
901 // if year == 0, you get 1 BCE.
906 year -= amount;
907 if (year > 0) {
908 set(YEAR, year);
909 } else { // year <= 0
910 set(YEAR, 1 - year);
911 // if year == 0, you get 1 CE
918 int year = internalGet(YEAR);
928 year += y_amount;
929 if (year > 0) {
930 set(YEAR, year);
931 } else { // year <= 0
932 set(YEAR, 1 - year);
933 // if year == 0, you get 1 BCE
938 year -= y_amount;
939 if (year > 0) {
940 set(YEAR, year);
941 } else { // year <= 0
942 set(YEAR, 1 - year);
943 // if year == 0, you get 1 CE
1220 // year and month due to the cutover.
1340 // If we are in the cutover year, convert nfd to
1358 // Cutover year handling
1391 // If the week of year is in the same year, we can
1401 // We need to handle it in a different way around year
1402 // boundaries and in the cutover year. Note that
1403 // changing era and year values violates the roll
1439 // Cutover year handling
1633 int year = gc.cdate.getNormalizedYear();
1634 if (year == gregorianCutoverYear || year == gregorianCutoverYearJulian) {
1653 * is 29 because 2004 is a leap year, and if the date of this
1658 * Calendar#YEAR YEAR} (calendar year) value, not the <a
1659 * href="#week_year">week year</a>. Call {@link
1661 * WEEK_OF_YEAR} in the week year of this {@code GregorianCalendar}.
1695 // January 1 of the next year may or may not exist.
1713 // Handle cutover year.
1733 // Handle cutover year.
1743 // January 1 of the next year may or may not exist.
1759 // Get the day of week of January 1 of the year
1816 // Cutover year handling
1859 /* The year computation is no different, in principle, from the
1872 * time, or era changes in response to setting the year. We don't
1873 * check for month, date, and time here because the year and era are
1874 * sufficient to detect an invalid year setting. NOTE: If code is
1876 * Feb 29 must be allowed to shift to Mar 1 when setting the year.
1884 // of the year of this calendar and adjust the max
1885 // year value if we are beyond the limit in the max
1886 // year.
1927 * year. This Calendar object must have been normalized.
1993 * Returns the <a href="#week_year">week year</a> represented by this
1995 * maximum week number of the week year have the same week year value
1996 * that may be one year before or after the {@link Calendar#YEAR YEAR}
1997 * (calendar year) value.
2000 * calculating the week year.
2002 * @return the week year represented by this {@code GregorianCalendar}.
2003 * If the {@link Calendar#ERA ERA} value is {@link #BC}, the year is
2016 int year = get(YEAR); // implicitly calls complete()
2018 year = 1 - year;
2023 if (year > gregorianCutoverYear + 1) {
2027 --year;
2031 ++year;
2034 return year;
2042 // Quickly check the possibility of year adjustments before
2045 return year;
2054 // Go to the first day of the year, which is usually January 1.
2058 // Get the first day of the first day-of-week in the year.
2069 --year;
2072 cal.set(YEAR, year + 1);
2089 ++year;
2093 return year;
2114 * <p>If {@code weekOfYear} is out of the valid week-of-year
2120 * @param weekYear the week year
2182 * Returns the number of weeks in the <a href="#week_year">week year</a>
2192 * @return the number of weeks in the week year.
2312 int year;
2337 year = gdate.getYear();
2338 if (year <= 0) {
2339 year = 1 - year;
2354 year = cdate.getYear();
2359 internalSet(YEAR, year);
2413 // If we are in the cutover year, we need some special handling.
2418 // gap could even be more than one year. (One
2419 // year difference in ~48667 years.)
2439 // previous year, use the week number of "12/31" of
2440 // the "previous" year. Again, if the previous year is
2441 // the Gregorian cutover year, we need to take care of
2501 // In case the gap is more than one year.
2594 // The year defaults to the epoch start. We don't check
2597 int year = isSet(YEAR) ? internalGet(YEAR) : EPOCH_YEAR;
2601 year = 1 - year;
2610 // If year is 0 or negative, we need to set the ERA value later.
2611 if (year <= 0 && !isSet(ERA)) {
2647 if (year > gregorianCutoverYear && year > gregorianCutoverYearJulian) {
2648 gfd = fixedDate + getFixedDate(gcal, year, fieldMask);
2653 jfd = fixedDate + getFixedDate(getJulianCalendarSystem(), year, fieldMask);
2654 } else if (year < gregorianCutoverYear && year < gregorianCutoverYearJulian) {
2655 jfd = fixedDate + getFixedDate(getJulianCalendarSystem(), year, fieldMask);
2662 jfd = fixedDate + getFixedDate(getJulianCalendarSystem(), year, fieldMask);
2663 gfd = fixedDate + getFixedDate(gcal, year, fieldMask);
2668 // If the date is relative from the beginning of the year
2674 } else if (year == gregorianCutoverYear) {
2773 * Julian calendar, using the given year and the specified calendar fields.
2776 * @param year the normalized year number, with 0 indicating the
2777 * year 1 BCE, -1 indicating 2 BCE, etc.
2782 private long getFixedDate(BaseCalendar cal, int year, int fieldMask) {
2791 year += month / 12;
2795 year += CalendarUtils.floorDivide(month, 12, rem);
2801 // the first day of either `month' or January in 'year'.
2802 long fixedDate = cal.getFixedDate(year, month + 1, 1,
2858 int lastDate = monthLength(month, year) + (7 * (dowim + 1));
2866 if (year == gregorianCutoverYear && cal == gcal
2869 // January 1 of the year doesn't exist. Use
2871 // year.
2874 // We are on the first day of the year.
2933 * in the cutover year. If the cutover date is January 1, the
2944 * Determines if the specified year (normalized) is the Gregorian
2945 * cutover year. This object must have been normalized.
2953 * Returns the fixed date of the first day of the year (usually
2956 * @param date the date for which the first day of the year is
2957 * calculated. The date has to be in the cut-over year (Gregorian
2967 // in the same (Gregorian) year. So, no
2968 // January 1 exists in the year. Use the
2969 // cutover date as the first day of the year.
2973 // January 1 of the normalized year should exist.
2983 * calculated. The date has to be in the cut-over year (Gregorian
2998 // The cutover happened sometime during the year.
3051 * year. The year number must be normalized.
3055 private final int monthLength(int month, int year) {
3056 return isLeapYear(year) ? LEAP_MONTH_LENGTH[month] : MONTH_LENGTH[month];
3060 * Returns the length of the specified month in the year provided
3066 int year = internalGet(YEAR);
3068 year = 1 - year;
3070 return monthLength(month, year);
3074 int year = cdate.getNormalizedYear();
3075 if (year != gregorianCutoverYear && year != gregorianCutoverYearJulian) {
3094 * Returns the length (in days) of the specified year. The year
3097 private final int yearLength(int year) {
3098 return isLeapYear(year) ? 366 : 365;
3102 * Returns the length (in days) of the year provided by
3106 int year = internalGet(YEAR);
3108 year = 1 - year;
3110 return yearLength(year);
3120 int year = internalGet(YEAR);
3122 if (year > gregorianCutoverYear || year < gregorianCutoverYearJulian) {