Class PersianCalendar

java.lang.Object
com.ibm.icu.util.Calendar
com.ibm.icu.util.PersianCalendar
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Calendar>

@Deprecated public class PersianCalendar extends Calendar
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 Calendar.getInstance(ULocale) passing in a ULocale with the tag "@calendar=persian".

Author:
Roozbeh Pournader
See Also:
  • Constructor Details

    • PersianCalendar

      @Deprecated 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.
      See Also:
    • PersianCalendar

      @Deprecated 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 - the given time zone.
      See Also:
    • PersianCalendar

      @Deprecated 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 - the given locale.
    • PersianCalendar

      @Deprecated 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 - the given ulocale.
    • PersianCalendar

      @Deprecated 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 - the given time zone.
      aLocale - the given locale.
    • PersianCalendar

      @Deprecated 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 - the given time zone.
      locale - the given ulocale.
    • PersianCalendar

      @Deprecated 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 - The date to which the new calendar is set.
      See Also:
    • PersianCalendar

      @Deprecated 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 - the value used to set the YEAR time field in the calendar.
      month - 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 - the value used to set the DATE time field in the calendar.
      See Also:
    • PersianCalendar

      @Deprecated 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 - the value used to set the YEAR time field in the calendar.
      month - 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 - the value used to set the DATE time field in the calendar.
      hour - the value used to set the HOUR_OF_DAY time field in the calendar.
      minute - the value used to set the MINUTE time field in the calendar.
      second - the value used to set the SECOND time field in the calendar.
      See Also:
  • Method Details

    • handleGetLimit

      @Deprecated protected int handleGetLimit(int field, int limitType)
      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 class Calendar
      Parameters:
      field - one of the above field numbers
      limitType - one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM
    • handleGetMonthLength

      @Deprecated protected int handleGetMonthLength(int extendedYear, int month)
      Deprecated.
      This API is ICU internal only.
      Return the length (in days) of the given month.
      Overrides:
      handleGetMonthLength in class Calendar
      Parameters:
      extendedYear - The Persian year
      month - The Persian month, 0-based
    • handleGetYearLength

      @Deprecated protected int handleGetYearLength(int extendedYear)
      Deprecated.
      This API is ICU internal only.
      Return the number of days in the given Persian year
      Overrides:
      handleGetYearLength in class Calendar
    • handleComputeMonthStart

      @Deprecated protected int handleComputeMonthStart(int eyear, int month, boolean useMonth)
      Deprecated.
      This API is ICU internal only.
      Return JD of start of given month/year
      Specified by:
      handleComputeMonthStart in class Calendar
      Parameters:
      eyear - the extended year
      month - the zero-based month, or 0 if useMonth is false
      useMonth - 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 protected int 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 class Calendar
      Returns:
      the extended year
    • handleComputeFields

      @Deprecated protected void handleComputeFields(int julianDay)
      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.
      Overrides:
      handleComputeFields in class Calendar
    • getType

      @Deprecated public String 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

      Overrides:
      getType in class Calendar
      Returns:
      legacy calendar type name string