Class PersianCalendar

All Implemented Interfaces:
Serializable, Comparable<PersianCalendar>, CalendarDate, ChronoDisplay, Temporal<CalendarDate>, LocalizedPatternSupport

@CalendarType("persian") public final class PersianCalendar extends Calendrical<PersianCalendar.Unit,​PersianCalendar> implements LocalizedPatternSupport

Represents the Solar Hijri calendar which is officially used in Iran and Afghanistan.

Introduction

It is a solar calendar which is in close agreement with the astronomical seasons. The vernal equinox serves as the first day of the Persian year (Farvardin 1st). If it is observed before noon at local time in Teheran then the associated day is the first day of the year else the next day. More details about the length of the vernal-equinox-year see: A concise review of the Iranian calendar

The calendar year is divided into 12 Persian months. The first 6 months are 31 days long. The following months are 30 days long with the exception of the last month whose length is 29 days in normal years and 30 days in leap years. The algorithm is based on the excellent work of Borkowski who describes the details at The Persian calendar for 3000 years. It is in agreement with the well known cycle proposed by Omar Khayam for the years 1178-1633 (ISO: 1799-2254). However, dates calculated in far future beyond 2123 can still be wrong due to the uncertainty of astronomical term delta-T and should be considered as approximation.

Following elements which are declared as constants are registered by this class

Furthermore, all elements defined in EpochDays and CommonElements are supported.

Example of usage

     ChronoFormatter<PersianCalendar> formatter =
       ChronoFormatter.setUp(PersianCalendar.axis(), new Locale("fa"))
       .addPattern("EEE, d. MMMM yy", PatternType.CLDR_DATE).build();
     PlainDate today = SystemClock.inLocalView().today();
     PersianCalendar jalali = today.transform(PersianCalendar.class);
     System.out.println(formatter.format(jalali));
 

Support for unicode ca-extensions

      Locale loc = Locale.forLanguageTag("de-IR-u-ca-persian");
      ChronoFormatter<CalendarDate> formatter = ChronoFormatter.ofGenericCalendarStyle(DisplayMode.MEDIUM, loc);
      PersianCalendar jalali = PersianCalendar.of(1393, 1, 10);
      PlainDate gregorian = jalali.transform(PlainDate.class);
      assertThat(formatter.format(jalali), is("10.01.1393 AP"));
      assertThat(formatter.format(gregorian), is("10.01.1393 AP"));
 
Since:
3.9/4.6
Author:
Meno Hochschild
See Also:
Serialized Form