Top Description Fields Constructors Methods
com.ibm.icu.util

public Class PersianCalendar

extends Calendar
Class Inheritance
Annotations
@Deprecated
Imports
java.util.Date, .Locale, com.ibm.icu.util.ULocale.Category

Deprecated

This API is ICU internal only.

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 com.ibm.icu.util.Calendar#getInstance(ULocale) passing in a ULocale with the tag "@calendar=persian".

Author
Roozbeh Pournader
ICU Status
Internal ICU component.
See Also
com.ibm.icu.util.GregorianCalendar, com.ibm.icu.util.Calendar

Field Summary

Modifier and TypeField and Description
private static final int[][]
private static final int[][]
private static final int
private static final long
Inherited from com.ibm.icu.util.Calendar:
AMAM_PMAPRILAUGUSTBASE_FIELD_COUNTDATEDATE_PRECEDENCEDAY_OF_MONTHDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHDAY_OF_YEARDECEMBERDOW_LOCALDOW_PRECEDENCEDST_OFFSETEPOCH_JULIAN_DAYERAEXTENDED_YEARFEBRUARYFRIDAYGREATEST_MINIMUMHOURHOUR_OF_DAYINTERNALLY_SETIS_LEAP_MONTHJAN_1_1_JULIAN_DAYJANUARYJULIAN_DAYJULYJUNELEAST_MAXIMUMMARCHMAX_DATEMAX_FIELD_COUNTMAX_JULIANMAX_MILLISMAXIMUMMAYMILLISECONDMILLISECONDS_IN_DAYMIN_DATEMIN_JULIANMIN_MILLISMINIMUMMINIMUM_USER_STAMPMINUTEMONDAYMONTHMONTH_PRECEDENCENOVEMBEROCTOBERONE_DAYONE_HOURONE_MINUTEONE_SECONDONE_WEEKORDINAL_MONTHPMRESOLVE_REMAPSATURDAYSECONDSEPTEMBERSUNDAYTHURSDAYTUESDAYUNDECIMBERUNSETWALLTIME_FIRSTWALLTIME_LASTWALLTIME_NEXT_VALIDWEDNESDAYWEEK_OF_MONTHWEEK_OF_YEARWEEKDAYWEEKENDWEEKEND_CEASEWEEKEND_ONSETYEARYEAR_WOYZONE_OFFSET

Constructor Summary

AccessConstructor and Description
public
PersianCalendar()

Deprecated This API is ICU internal only.
Constructs a default PersianCalendar using the current time in the default time zone with the default FORMAT locale.
public
PersianCalendar(TimeZone
the given time zone.
zone
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar based on the current time in the given time zone with the default FORMAT locale.
public
PersianCalendar(Locale
the given locale.
aLocale
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar based on the current time in the default time zone with the given locale.
public
PersianCalendar(ULocale
the given ulocale.
locale
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar based on the current time in the default time zone with the given locale.
public
PersianCalendar(TimeZone
the given time zone.
zone
,
Locale
the given locale.
aLocale
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar based on the current time in the given time zone with the given locale.
public
PersianCalendar(TimeZone
the given time zone.
zone
,
ULocale
the given ulocale.
locale
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar based on the current time in the given time zone with the given locale.
public
PersianCalendar(Date
The date to which the new calendar is set.
date
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar with the given date set in the default time zone with the default FORMAT locale.
public
PersianCalendar(int
the value used to set the YEAR time field in the calendar.
year
,
int
the value used to set the MONTH time field in the calendar. Note that the month value is 0-based. e.g., 0 for Farvardin.
month
,
int
the value used to set the DATE time field in the calendar.
date
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar with the given date set in the default time zone with the default FORMAT locale.
public
PersianCalendar(int
the value used to set the YEAR time field in the calendar.
year
,
int
the value used to set the MONTH time field in the calendar. Note that the month value is 0-based. e.g., 0 for Farvardin.
month
,
int
the value used to set the DATE time field in the calendar.
date
,
int
the value used to set the HOUR_OF_DAY time field in the calendar.
hour
,
int
the value used to set the MINUTE time field in the calendar.
minute
,
int
the value used to set the SECOND time field in the calendar.
second
)

Deprecated This API is ICU internal only.
Constructs a PersianCalendar with the given date and time set for the default time zone with the default FORMAT locale.

Method Summary

Modifier and TypeMethod and Description
public String
getType()

Overrides com.ibm.icu.util.Calendar.getType.

Deprecated This API is ICU internal only.

ICU

protected void
handleComputeFields(int julianDay)

Overrides com.ibm.icu.util.Calendar.handleComputeFields.

Deprecated This API is ICU internal only.
Override Calendar to compute several fields specific to the Persian calendar system.
protected int
handleComputeMonthStart(int
the extended year
eyear
,
int
the zero-based month, or 0 if useMonth is false
month
,
boolean
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
useMonth
)

Implements abstract com.ibm.icu.util.Calendar.handleComputeMonthStart.

Deprecated This API is ICU internal only.
Return JD of start of given month/year
protected int
handleGetExtendedYear()

Implements abstract com.ibm.icu.util.Calendar.handleGetExtendedYear.

Deprecated This API is ICU internal only.
Returns the extended year defined by the current fields.
protected int
handleGetLimit(int
one of the above field numbers
field
,
int
one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM
limitType
)

Implements abstract com.ibm.icu.util.Calendar.handleGetLimit.

Deprecated This API is ICU internal only.
Subclass API for defining limits of different types.
protected int
handleGetMonthLength(int
The Persian year
extendedYear
,
int
The Persian month, 0-based
month
)

Overrides com.ibm.icu.util.Calendar.handleGetMonthLength.

Deprecated This API is ICU internal only.
Return the length (in days) of the given month.
protected int
handleGetYearLength(int extendedYear)

Overrides com.ibm.icu.util.Calendar.handleGetYearLength.

Deprecated This API is ICU internal only.
Return the number of days in the given Persian year
private static final boolean
isLeapYear(int year)

Determine whether a year is a leap year in the Persian calendar

Inherited from com.ibm.icu.util.Calendar:
addafterbeforeclearclearclonecompareTocompletecomputeFieldscomputeGregorianFieldscomputeGregorianMonthStartcomputeJulianDaycomputeMillisInDaycomputeMillisInDayLongcomputeTimecomputeZoneOffsetcomputeZoneOffsetequalsfieldDifferencefieldNamefloorDividefloorDividefloorDividefloorDividegetgetActualMaximumgetActualMinimumgetAvailableLocalesgetAvailableULocalesgetDateAtTimePatterngetDateTimeFormatgetDateTimeFormatgetDateTimePatterngetDayOfWeekTypegetDefaultDayInMonthgetDefaultMonthInYeargetDisplayNamegetDisplayNamegetFieldCountgetFieldResolutionTablegetFirstDayOfWeekgetGreatestMinimumgetGregorianDayOfMonthgetGregorianDayOfYeargetGregorianMonthgetGregorianYeargetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetKeywordValuesForLocalegetLeastMaximumgetLimitgetLocalegetMaximumgetMinimalDaysInFirstWeekgetMinimumgetRelatedYeargetRepeatedWallTimeOptiongetSkippedWallTimeOptiongetStampgetTemporalMonthCodegetTimegetTimeInMillisgetTimeZonegetWeekDatagetWeekDataForRegiongetWeekendTransitiongregorianMonthLengthgregorianPreviousMonthLengthhandleComputeJulianDayhandleCreateFieldshandleGetDateFormathandleGetDateFormathandleGetDateFormathandleGetDateFormathashCodehaveDefaultCenturyinTemporalLeapYearinternalGetinternalGetinternalGetMonthinternalGetMonthinternalGetTimeInMillisinternalSetisEquivalentToisGregorianLeapYearisLenientisSetisWeekendisWeekendjulianDayToDayOfWeekjulianDayToMillismillisToJulianDaynewerFieldnewestStamppinFieldprepareGetActualresolveFieldsrollrollsetsetsetsetsetFirstDayOfWeeksetLenientsetLocalesetMinimalDaysInFirstWeeksetRelatedYearsetRepeatedWallTimeOptionsetSkippedWallTimeOptionsetTemporalMonthCodesetTimesetTimeInMillissetTimeZonesetWeekDatatoStringvalidateFieldvalidateFieldvalidateFieldsweekNumberweekNumber

Field Detail

LIMITSback to summary
private static final int[][] LIMITS

Hides com.ibm.icu.util.Calendar.LIMITS.

MONTH_COUNTback to summary
private static final int[][] MONTH_COUNT
PERSIAN_EPOCHback to summary
private static final int PERSIAN_EPOCH
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.ibm.icu.util.Calendar.serialVersionUID.

Constructor Detail

PersianCalendarback to summary
public PersianCalendar()

Deprecated

This API is ICU internal only.

Constructs a default PersianCalendar using the current time in the default time zone with the default FORMAT locale.

Annotations
@Deprecated
ICU Status
Internal ICU component.
See Also
Category#FORMAT
PersianCalendarback to summary
public PersianCalendar(TimeZone zone)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar based on the current time in the given time zone with the default FORMAT locale.

Parameters
zone:TimeZone

the given time zone.

Annotations
@Deprecated
ICU Status
Internal ICU component.
See Also
Category#FORMAT
PersianCalendarback to summary
public PersianCalendar(Locale aLocale)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar based on the current time in the default time zone with the given locale.

Parameters
aLocale:Locale

the given locale.

Annotations
@Deprecated
ICU Status
Internal ICU component.
PersianCalendarback to summary
public PersianCalendar(ULocale locale)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar based on the current time in the default time zone with the given locale.

Parameters
locale:ULocale

the given ulocale.

Annotations
@Deprecated
ICU Status
Internal ICU component.
PersianCalendarback to summary
public PersianCalendar(TimeZone zone, Locale aLocale)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar based on the current time in the given time zone with the given locale.

Parameters
zone:TimeZone

the given time zone.

aLocale:Locale

the given locale.

Annotations
@Deprecated
ICU Status
Internal ICU component.
PersianCalendarback to summary
public PersianCalendar(TimeZone zone, ULocale locale)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar based on the current time in the given time zone with the given locale.

Parameters
zone:TimeZone

the given time zone.

locale:ULocale

the given ulocale.

Annotations
@Deprecated
ICU Status
Internal ICU component.
PersianCalendarback to summary
public PersianCalendar(Date date)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar with the given date set in the default time zone with the default FORMAT locale.

Parameters
date:Date

The date to which the new calendar is set.

Annotations
@Deprecated
ICU Status
Internal ICU component.
See Also
Category#FORMAT
PersianCalendarback to summary
public PersianCalendar(int year, int month, int date)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar with the given date set in the default time zone with the default FORMAT locale.

Parameters
year:int

the value used to set the YEAR time field in the calendar.

month:int

the value used to set the MONTH time field in the calendar. Note that the month value is 0-based. e.g., 0 for Farvardin.

date:int

the value used to set the DATE time field in the calendar.

Annotations
@Deprecated
ICU Status
Internal ICU component.
See Also
Category#FORMAT
PersianCalendarback to summary
public PersianCalendar(int year, int month, int date, int hour, int minute, int second)

Deprecated

This API is ICU internal only.

Constructs a PersianCalendar with the given date and time set for the default time zone with the default FORMAT locale.

Parameters
year:int

the value used to set the YEAR time field in the calendar.

month:int

the value used to set the MONTH time field in the calendar. Note that the month value is 0-based. e.g., 0 for Farvardin.

date:int

the value used to set the DATE time field in the calendar.

hour:int

the value used to set the HOUR_OF_DAY time field in the calendar.

minute:int

the value used to set the MINUTE time field in the calendar.

second:int

the value used to set the SECOND time field in the calendar.

Annotations
@Deprecated
ICU Status
Internal ICU component.
See Also
Category#FORMAT

Method Detail

getTypeback to summary
public String getType()

Overrides com.ibm.icu.util.Calendar.getType.

Doc from com.ibm.icu.util.Calendar.getType.

Deprecated

This API is ICU internal only.

ICU

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

Returns:String

legacy calendar type name string

Annotations
@Deprecated
ICU Status
Internal ICU component.
handleComputeFieldsback to summary
protected void handleComputeFields(int julianDay)

Overrides com.ibm.icu.util.Calendar.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
The DAY_OF_WEEK and DOW_LOCAL fields are already set when this method is called.
Annotations
@Deprecated
ICU Status
Internal ICU component.
handleComputeMonthStartback to summary
protected int handleComputeMonthStart(int eyear, int month, boolean useMonth)

Implements abstract com.ibm.icu.util.Calendar.handleComputeMonthStart.

Deprecated

This API is ICU internal only.

Return JD of start of given month/year

Parameters
eyear:int

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

the extended year

month:int

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

the zero-based month, or 0 if useMonth is false

useMonth:boolean

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

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:int

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

the Julian day number of the day before the first day of the given month and year

Annotations
@Deprecated
ICU Status
Internal ICU component.
handleGetExtendedYearback to summary
protected int handleGetExtendedYear()

Implements abstract com.ibm.icu.util.Calendar.handleGetExtendedYear.

Doc from com.ibm.icu.util.Calendar.handleGetExtendedYear.

Deprecated

This API is ICU internal only.

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.

Returns:int

the extended year

Annotations
@Deprecated
ICU Status
Internal ICU component.
handleGetLimitback to summary
protected int handleGetLimit(int field, int limitType)

Implements abstract com.ibm.icu.util.Calendar.handleGetLimit.

Doc from com.ibm.icu.util.Calendar.handleGetLimit.

Deprecated

This API is ICU internal only.

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
Parameters
field:int

one of the above field numbers

limitType:int

one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM

Annotations
@Deprecated
ICU Status
Internal ICU component.
handleGetMonthLengthback to summary
protected int handleGetMonthLength(int extendedYear, int month)

Overrides com.ibm.icu.util.Calendar.handleGetMonthLength.

Deprecated

This API is ICU internal only.

Return the length (in days) of the given month.

Parameters
extendedYear:int

The Persian year

month:int

The Persian month, 0-based

Annotations
@Deprecated
ICU Status
Internal ICU component.
handleGetYearLengthback to summary
protected int handleGetYearLength(int extendedYear)

Overrides com.ibm.icu.util.Calendar.handleGetYearLength.

Deprecated

This API is ICU internal only.

Return the number of days in the given Persian year

Annotations
@Deprecated
ICU Status
Internal ICU component.
isLeapYearback to summary
private static final boolean isLeapYear(int year)

Determine whether a year is a leap year in the Persian calendar