The IntlCalendar class
Calendar field numerically representing an era, for instance 1 for AD and 0 for BC in the Gregorian/Julian calendars and 235 for the Heisei (平成) era in the Japanese calendar. Not all calendars have more than one era.
Intro
Class synopsis
Predefined Constants
IntlCalendar::FIELD_ERAintCalendar field numerically representing an era, for instance
1for AD and0for BC in the Gregorian/Julian calendars and235for the Heisei (平成) era in the Japanese calendar. Not all calendars have more than one era.IntlCalendar::FIELD_YEARintCalendar field for the year. This is not unique across eras. If the calendar type has more than one era, generally the minimum value for this field will be
1.IntlCalendar::FIELD_MONTHintCalendar field for the month. The month sequence is zero-based, so January (here used to signify the first month of the calendar; this may be called another name, such as Muharram in the Islamic calendar) is represented by
0, February by1, …, December by11and, for calendars that have it, the 13th or leap month by12.IntlCalendar::FIELD_WEEK_OF_YEARintCalendar field for the number of the week of the year. This depends on which day of the week is deemed to start the week and the minimal number of days in a week.
IntlCalendar::FIELD_WEEK_OF_MONTHintCalendar field for the number of the week of the month. This depends on which day of the week is deemed to start the week and the minimal number of days in a week.
IntlCalendar::FIELD_DATEintCalendar field for the day of the month. The same as
IntlCalendar::FIELD_DAY_OF_MONTH, which has a clearer name.IntlCalendar::FIELD_DAY_OF_YEARintCalendar field for the day of the year. For the Gregorian calendar, starts with
1and ends with365or366.IntlCalendar::FIELD_DAY_OF_WEEKintCalendar field for the day of the week. Its values start with
1(Sunday, seeIntlCalendar::DOW_SUNDAYand subsequent constants) and the last valid value is 7 (Saturday).IntlCalendar::FIELD_DAY_OF_WEEK_IN_MONTHintGiven a day of the week (Sunday, Monday, …), this calendar field assigns an ordinal to such a day of the week in a specific month. Thus, if the value of this field is
1and the value of the day of the week is2(Monday), then the set day of the month is the 1st Monday of the month; the maximum value is5.Additionally, the value
0and negative values are also allowed. The value0encompasses the seven days that occur immediately before the first seven days of a month (which therefore have a ‘day of week in month’ with value1). Negative values starts counting from the end of the month –-1points to the last occurrence of a day of the week in a month,-2to the second last, and so on.Unlike
IntlCalendar::FIELD_WEEK_OF_MONTHandIntlCalendar::FIELD_WEEK_OF_YEAR, this value does not depend onIntlCalendar::getFirstDayOfWeek()or onIntlCalendar::getMinimalDaysInFirstWeek(). The first Monday is the first Monday, even if it occurs in a week that belongs to the previous month.IntlCalendar::FIELD_AM_PMintCalendar field indicating whether a time is before noon (value
0, AM) or after (1). Midnight is AM, noon is PM.IntlCalendar::FIELD_HOURintCalendar field for the hour, without specifying whether itʼs in the morning or in the afternoon. Valid values are
0to11.IntlCalendar::FIELD_HOUR_OF_DAYintCalendar field for the full (24h) hour of the day. Valid values are
0to23.IntlCalendar::FIELD_MINUTEintCalendar field for the minutes component of the time.
IntlCalendar::FIELD_SECONDintCalendar field for the seconds component of the time.
IntlCalendar::FIELD_MILLISECONDintCalendar field the milliseconds component of the time.
IntlCalendar::FIELD_ZONE_OFFSETintCalendar field indicating the raw offset of the timezone, in milliseconds. The raw offset is the timezone offset, excluding any offset due to daylight saving time.
IntlCalendar::FIELD_DST_OFFSETintCalendar field for the daylight saving time offset of the calendarʼs timezone, in milliseconds, if active for calendarʼs time.
IntlCalendar::FIELD_YEAR_WOYintCalendar field representing the year for week of year purposes.
IntlCalendar::FIELD_DOW_LOCALintCalendar field for the localized day of the week. This is a value between
1and7,1being used for the day of the week that matches the value returned byIntlCalendar::getFirstDayOfWeek().IntlCalendar::FIELD_EXTENDED_YEARintCalendar field for a year number representation that is continuous across eras. For the Gregorian calendar, the value of this field matches that of
IntlCalendar::FIELD_YEARfor AD years; a BC yearyis represented by-y + 1.IntlCalendar::FIELD_JULIAN_DAYintCalendar field for a modified Julian day number. It is different from a conventional Julian day number in that its transitions occur at local zone midnight rather than at noon UTC. It uniquely identifies a date.
IntlCalendar::FIELD_MILLISECONDS_IN_DAYintCalendar field encompassing the information in
IntlCalendar::FIELD_HOUR_OF_DAY,IntlCalendar::FIELD_MINUTE,IntlCalendar::FIELD_SECONDandIntlCalendar::FIELD_MILLISECOND. Range is from the0to24 * 3600 * 1000 - 1. It is not the amount of milliseconds elapsed in the day since on DST transitions it will have discontinuities analog to those of the wall time.IntlCalendar::FIELD_IS_LEAP_MONTHintCalendar field whose value is
1for indicating a leap month and0otherwise.IntlCalendar::FIELD_FIELD_COUNTintThe total number of fields.
IntlCalendar::FIELD_DAY_OF_MONTHintAlias for
IntlCalendar::FIELD_DATE.IntlCalendar::DOW_SUNDAYintSunday.
IntlCalendar::DOW_MONDAYintMonday.
IntlCalendar::DOW_TUESDAYintTuesday.
IntlCalendar::DOW_WEDNESDAYintWednesday.
IntlCalendar::DOW_THURSDAYintThursday.
IntlCalendar::DOW_FRIDAYintFriday.
IntlCalendar::DOW_SATURDAYintSaturday.
IntlCalendar::DOW_TYPE_WEEKDAYintOutput of
IntlCalendar::getDayOfWeekType()indicating a day of week is a weekday.IntlCalendar::DOW_TYPE_WEEKENDintOutput of
IntlCalendar::getDayOfWeekType()indicating a day of week belongs to the weekend.IntlCalendar::DOW_TYPE_WEEKEND_OFFSETintOutput of
IntlCalendar::getDayOfWeekType()indicating the weekend begins during the given day of week.IntlCalendar::DOW_TYPE_WEEKEND_CEASEintOutput of
IntlCalendar::getDayOfWeekType()indicating the weekend ends during the given day of week.IntlCalendar::WALLTIME_FIRSTintOutput of
IntlCalendar::getSkippedWallTimeOption()indicating that wall times in the skipped range should refer to the same instant as wall times with one hour less and ofIntlCalendar::getRepeatedWallTimeOption()indicating the wall times in the repeated range should refer to the instant of the first occurrence of such wall time.IntlCalendar::WALLTIME_LASTintOutput of
IntlCalendar::getSkippedWallTimeOption()indicating that wall times in the skipped range should refer to the same instant as wall times with one hour after and ofIntlCalendar::getRepeatedWallTimeOption()indicating the wall times in the repeated range should refer to the instant of the second occurrence of such wall time.IntlCalendar::WALLTIME_NEXT_VALIDintOutput of
IntlCalendar::getSkippedWallTimeOption()indicating that wall times in the skipped range should refer to the instant when the daylight saving time transition occurs (begins).
Changelog
| Version | Description |
|---|---|
| 8.4.0 | The class constants are now typed. |
Intlcalendar