Class PersianCalendar
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Calendar>
PersianCalendar
is a subclass of Calendar
that
that implements the Persian calendar. It is used as the main civil
calendar in Iran and Afghanistan, and by Iranians and Afghans worldwide.
The Persian calendar is solar, and is similar to the Gregorian calendar in various ways, except its leap year rule, which is determined astronomically. The Persian year starts around the March equinox.
The modern Persian calendar (used in Iran since 1925 CE and in Afghanistan since 1957 CE), has the lengths of the months fixed. The first six months are 31 days each, the next five months are 30 days each, and the final month is 29 days in non-leap years and 30 days in leap ones. Historically, the lengths of the month differed in different years, but they were finally fixed at the times mentioned above. Partial information is available about the historical lengths.
The official rule for determination of the beginning of the Persian year is locale dependent, but at the same time, it has not specified a locale. Iranians around the world traditionally follow the calendar authorities of Iran, which haven't officially specified the locale. Some calendarists use some point in Tehran as the locale, while others have tried the more neutral 52.5 degrees east meridian. It is not clear which locale should be used for the Persian calendar of Afghanistan, but it is expected that for about one year in every twenty-four years, the Afghan calendar may become different from the Iranian one.
The exact locale to be used for the Iranian calendar starts to make a difference at around 2090 CE. The specific arithmetic method implemented here, commonly known as the 33-year cycle rule, matches the astronomical calendar at least for the whole period that the calendar has been both well-defined and official, from 1925 to around 2090 CE. The other commonly known algorithm, the 2820-year cycle, has been incorrectly designed to follow the tropical year instead of the spring equinoctial year, and fails to match the astronomical one as early as 2025 CE.
This class should not be subclassed.
PersianCalendar usually should be instantiated using
Calendar.getInstance(ULocale)
passing in a
ULocale
with the tag "@calendar=persian"
.
- Author:
- Roozbeh Pournader
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ibm.icu.util.Calendar
Calendar.FormatConfiguration, Calendar.WeekData
-
Field Summary
Fields inherited from class com.ibm.icu.util.Calendar
AM, AM_PM, APRIL, AUGUST, BASE_FIELD_COUNT, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, EPOCH_JULIAN_DAY, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, GREATEST_MINIMUM, HOUR, HOUR_OF_DAY, INTERNALLY_SET, IS_LEAP_MONTH, JAN_1_1_JULIAN_DAY, JANUARY, JULIAN_DAY, JULY, JUNE, LEAST_MAXIMUM, MARCH, MAX_DATE, MAX_FIELD_COUNT, MAX_JULIAN, MAX_MILLIS, MAXIMUM, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MIN_DATE, MIN_JULIAN, MIN_MILLIS, MINIMUM, MINIMUM_USER_STAMP, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PM, RESOLVE_REMAP, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, UNSET, WALLTIME_FIRST, WALLTIME_LAST, WALLTIME_NEXT_VALID, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, YEAR, YEAR_WOY, ZONE_OFFSET
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.This API is ICU internal only.PersianCalendar
(int year, int month, int date) Deprecated.This API is ICU internal only.PersianCalendar
(int year, int month, int date, int hour, int minute, int second) Deprecated.This API is ICU internal only.PersianCalendar
(TimeZone zone) Deprecated.This API is ICU internal only.PersianCalendar
(TimeZone zone, ULocale locale) Deprecated.This API is ICU internal only.PersianCalendar
(TimeZone zone, Locale aLocale) Deprecated.This API is ICU internal only.PersianCalendar
(ULocale locale) Deprecated.This API is ICU internal only.PersianCalendar
(Date date) Deprecated.This API is ICU internal only.PersianCalendar
(Locale aLocale) Deprecated.This API is ICU internal only. -
Method Summary
Modifier and TypeMethodDescriptiongetType()
Deprecated.This API is ICU internal only.protected void
handleComputeFields
(int julianDay) Deprecated.This API is ICU internal only.protected int
handleComputeMonthStart
(int eyear, int month, boolean useMonth) Deprecated.This API is ICU internal only.protected int
Deprecated.This API is ICU internal only.protected int
handleGetLimit
(int field, int limitType) Deprecated.This API is ICU internal only.protected int
handleGetMonthLength
(int extendedYear, int month) Deprecated.This API is ICU internal only.protected int
handleGetYearLength
(int extendedYear) Deprecated.This API is ICU internal only.Methods inherited from class com.ibm.icu.util.Calendar
add, after, before, clear, clear, clone, compareTo, complete, computeFields, computeGregorianFields, computeGregorianMonthStart, computeJulianDay, computeMillisInDay, computeMillisInDayLong, computeTime, computeZoneOffset, computeZoneOffset, equals, fieldDifference, fieldName, floorDivide, floorDivide, floorDivide, floorDivide, get, getActualMaximum, getActualMinimum, getAvailableLocales, getAvailableULocales, getDateAtTimePattern, getDateTimeFormat, getDateTimeFormat, getDateTimePattern, getDayOfWeekType, getDefaultDayInMonth, getDefaultMonthInYear, getDisplayName, getDisplayName, getFieldCount, getFieldResolutionTable, getFirstDayOfWeek, getGreatestMinimum, getGregorianDayOfMonth, getGregorianDayOfYear, getGregorianMonth, getGregorianYear, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getKeywordValuesForLocale, getLeastMaximum, getLimit, getLocale, getMaximum, getMinimalDaysInFirstWeek, getMinimum, getRelatedYear, getRepeatedWallTimeOption, getSkippedWallTimeOption, getStamp, getTime, getTimeInMillis, getTimeZone, getWeekData, getWeekDataForRegion, getWeekendTransition, gregorianMonthLength, gregorianPreviousMonthLength, handleComputeJulianDay, handleCreateFields, handleGetDateFormat, handleGetDateFormat, handleGetDateFormat, handleGetDateFormat, hashCode, haveDefaultCentury, internalGet, internalGet, internalGetTimeInMillis, internalSet, isEquivalentTo, isGregorianLeapYear, isLenient, isSet, isWeekend, isWeekend, julianDayToDayOfWeek, julianDayToMillis, millisToJulianDay, newerField, newestStamp, pinField, prepareGetActual, resolveFields, roll, roll, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setRelatedYear, setRepeatedWallTimeOption, setSkippedWallTimeOption, setTime, setTimeInMillis, setTimeZone, setWeekData, toString, validateField, validateField, validateFields, weekNumber, weekNumber
-
Constructor Details
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs a defaultPersianCalendar
using the current time in the default time zone with the defaultFORMAT
locale.- See Also:
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
based on the current time in the given time zone with the defaultFORMAT
locale.- Parameters:
zone
- the given time zone.- See Also:
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
based on the current time in the default time zone with the given locale.- Parameters:
aLocale
- the given locale.
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
based on the current time in the default time zone with the given locale.- Parameters:
locale
- the given ulocale.
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
based on the current time in the given time zone with the given locale.- Parameters:
zone
- the given time zone.aLocale
- the given locale.
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
based on the current time in the given time zone with the given locale.- Parameters:
zone
- the given time zone.locale
- the given ulocale.
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
with the given date set in the default time zone with the defaultFORMAT
locale.- Parameters:
date
- The date to which the new calendar is set.- See Also:
-
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
with the given date set in the default time zone with the defaultFORMAT
locale. -
PersianCalendar
Deprecated.This API is ICU internal only.Constructs aPersianCalendar
with the given date and time set for the default time zone with the defaultFORMAT
locale.- Parameters:
year
- the value used to set theYEAR
time field in the calendar.month
- the value used to set theMONTH
time field in the calendar. Note that the month value is 0-based. e.g., 0 for Farvardin.date
- the value used to set theDATE
time field in the calendar.hour
- the value used to set theHOUR_OF_DAY
time field in the calendar.minute
- the value used to set theMINUTE
time field in the calendar.second
- the value used to set theSECOND
time field in the calendar.- See Also:
-
-
Method Details
-
handleGetLimit
Deprecated.This API is ICU internal only.Description copied from class:Calendar
Subclass API for defining limits of different types. Subclasses must implement this method to return limits for the following fields:ERA YEAR MONTH WEEK_OF_YEAR WEEK_OF_MONTH DAY_OF_MONTH DAY_OF_YEAR DAY_OF_WEEK_IN_MONTH YEAR_WOY EXTENDED_YEAR
- Specified by:
handleGetLimit
in classCalendar
- Parameters:
field
- one of the above field numberslimitType
- one ofMINIMUM
,GREATEST_MINIMUM
,LEAST_MAXIMUM
, orMAXIMUM
-
handleGetMonthLength
Deprecated.This API is ICU internal only.Return the length (in days) of the given month.- Overrides:
handleGetMonthLength
in classCalendar
- Parameters:
extendedYear
- The Persian yearmonth
- The Persian month, 0-based
-
handleGetYearLength
Deprecated.This API is ICU internal only.Return the number of days in the given Persian year- Overrides:
handleGetYearLength
in classCalendar
-
handleComputeMonthStart
Deprecated.This API is ICU internal only.Return JD of start of given month/year- Specified by:
handleComputeMonthStart
in classCalendar
- Parameters:
eyear
- the extended yearmonth
- the zero-based month, or 0 if useMonth is falseuseMonth
- if false, compute the day before the first day of the given year, otherwise, compute the day before the first day of the given month- Returns:
- the Julian day number of the day before the first day of the given month and year
-
handleGetExtendedYear
Deprecated.This API is ICU internal only.Description copied from class:Calendar
Returns the extended year defined by the current fields. This will use the EXTENDED_YEAR field or the YEAR and supra-year fields (such as ERA) specific to the calendar system, depending on which set of fields is newer.- Specified by:
handleGetExtendedYear
in classCalendar
- Returns:
- the extended year
-
handleComputeFields
Deprecated.This API is ICU internal only.Override Calendar to compute several fields specific to the Persian calendar system. These are:- ERA
- YEAR
- MONTH
- DAY_OF_MONTH
- DAY_OF_YEAR
- EXTENDED_YEAR
- Overrides:
handleComputeFields
in classCalendar
-
getType
Deprecated.This API is ICU internal only.Returns the calendar type name string for this Calendar object. The returned string is the legacy ICU calendar attribute value, for example, "gregorian" or "japanese".See type="old type name" for the calendar attribute of locale IDs at http://www.unicode.org/reports/tr35/#Key_Type_Definitions
-