@Immutable
public final class PersianChronology
extends java.time.chrono.AbstractChronology
Length of each month is between 29 to 31 days. Details of each month is implemented in
PersianMonth enum.
Normal yeras have 365 days and leap years have 366 days.
This is an immutable and thread-safe enum.
| Modifier and Type | Field and Description |
|---|---|
static PersianChronology |
INSTANCE
Single instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
PersianDate |
date(int prolepticYear,
int month,
int dayOfMonth)
Obtains a local date in this chronology from the proleptic-year,
month-of-year and day-of-month fields.
|
PersianDate |
date(java.time.temporal.TemporalAccessor temporal)
Obtains a local date in this chronology from another temporal object.
|
PersianDate |
dateEpochDay(long epochDay)
Obtains a local date in this chronology from the epoch-day.
|
PersianDate |
dateYearDay(int prolepticYear,
int dayOfYear)
Obtains a local date in this chronology from the proleptic-year and
day-of-year fields.
|
java.time.chrono.Era |
eraOf(int eraValue)
Creates the chronology era object from the numeric value.
|
java.util.List<java.time.chrono.Era> |
eras()
Gets the list of eras for the chronology.
|
java.lang.String |
getCalendarType()
Gets the calendar type of the Persian calendar.
|
java.lang.String |
getId()
Gets the ID of the chronology.
|
boolean |
isLeapYear(long year)
Returns true if
year is a leap year in Persian calendar. |
int |
prolepticYear(java.time.chrono.Era era,
int yearOfEra)
Calculates the proleptic-year given the era and year-of-era.
|
java.time.temporal.ValueRange |
range(java.time.temporal.ChronoField field)
Gets the range of valid values for the specified field.
|
compareTo, equals, hashCode, resolveDate, toStringpublic static final PersianChronology INSTANCE
public java.lang.String getId()
getCalendarType()public java.lang.String getCalendarType()
getId()public PersianDate date(int prolepticYear, int month, int dayOfMonth)
prolepticYear - the chronology proleptic-yearmonth - the chronology month-of-yeardayOfMonth - the chronology day-of-monthjava.time.DateTimeException - if unable to create the datepublic PersianDate dateYearDay(int prolepticYear, int dayOfYear)
prolepticYear - the chronology proleptic-yeardayOfYear - the chronology day-of-yearjava.time.DateTimeException - if unable to create the datepublic PersianDate dateEpochDay(long epochDay)
The definition of EPOCH_DAY is the same
for all calendar systems, thus it can be used for conversion.
epochDay - the epoch dayjava.time.DateTimeException - if unable to create the datepublic PersianDate date(java.time.temporal.TemporalAccessor temporal)
This obtains a date in this chronology based on the specified temporal.
A TemporalAccessor represents an arbitrary set of date and time information,
which this factory converts to an instance of ChronoLocalDate.
The conversion typically uses the EPOCH_DAY
field, which is standardized across calendar systems.
This method matches the signature of the functional interface TemporalQuery
allowing it to be used as a query via method reference, aChronology::date.
temporal - the temporal object to convert, not nulljava.time.DateTimeException - if unable to create the dateChronoLocalDate.from(TemporalAccessor)public boolean isLeapYear(long year)
year is a leap year in Persian calendar.year - the year to be checked whether is a leap year or not. For valid
range, check range(ChronoField YEAR).year is a leap year in Persian calendarpublic int prolepticYear(java.time.chrono.Era era,
int yearOfEra)
This combines the era and year-of-era into the single proleptic-year field.
era - the era of the correct type for the chronology, not nullyearOfEra - the chronology year-of-erajava.time.DateTimeException - if unable to convert to a proleptic-year,
such as if the year is invalid for the erajava.lang.ClassCastException - if the era is not of the correct type for the chronologypublic java.time.chrono.Era eraOf(int eraValue)
The era is, conceptually, the largest division of the time-line. Most calendar systems have a single epoch dividing the time-line into two eras. However, some have multiple eras, such as one for the reign of each leader. The exact meaning is determined by the chronology according to the following constraints.
This method returns the singleton era of the correct type for the specified era value.
eraValue - the era valuejava.time.DateTimeException - if unable to create the erapublic java.util.List<java.time.chrono.Era> eras()
public java.time.temporal.ValueRange range(java.time.temporal.ChronoField field)
All fields can be expressed as a long integer.
This method returns an object that describes the valid range for that value.
Note that the result only describes the minimum and maximum valid values and it is important not to read too much into them. For example, there could be values within the range that are invalid for the field.
This method will return a result whether or not the chronology supports the field.
field - the field to get the range for, not nulljava.time.DateTimeException - if the range for the field cannot be obtainedCopyright © 2021. All rights reserved.