org.joda.time.chrono

Class IslamicChronology

Implemented Interfaces:
Serializable

public final class IslamicChronology
extends org.joda.time.chrono.BasicChronology

Implements the Islamic, or Hijri, calendar system using arithmetic rules.

This calendar is a lunar calendar with a shorter year than ISO. Year 1 in the Islamic calendar began on July 16, 622 CE (Julian), thus Islamic years do not begin at the same time as Julian years. This chronology is not proleptic, as it does not allow dates before the first Islamic year.

There are two basic forms of the Islamic calendar, the tabular and the observed. The observed form cannot easily be used by computers as it relies on human observation of the new moon. The tabular calendar, implemented here, is an arithmetical approximation of the observed form that follows relatively simple rules.

The tabular form of the calendar defines 12 months of alternately 30 and 29 days. The last month is extended to 30 days in a leap year. Leap years occur according to a 30 year cycle. There are four recognised patterns of leap years in the 30 year cycle:

 Years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26 & 29 - 15-based, used by Microsoft
 Years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26 & 29 - 16-based, most commonly used
 Years 2, 5, 8, 10, 13, 16, 19, 21, 24, 27 & 29 - Indian
 Years 2, 5, 8, 11, 13, 16, 19, 21, 24, 27 & 30 - Habash al-Hasib
 
You can select which pattern to use via the factory methods, or use the default (16-based).

This implementation defines a day as midnight to midnight exactly as per the ISO chronology. This correct start of day is at sunset on the previous day, however this cannot readily be modelled and has been ignored.

IslamicChronology is thread-safe and immutable.

Author:
Stephen Colebourne
Since:
1.2
See Also:
Wikipedia

Nested Class Summary

static class
IslamicChronology.LeapYearPatternType
Opaque object describing a leap year pattern for the Islamic Chronology.

Nested classes/interfaces inherited from class org.joda.time.chrono.AssembledChronology

AssembledChronology.Fields

Field Summary

static int
AH
Constant value for 'Anno Hegirae', equivalent to the value returned for AD/CE.
static IslamicChronology.LeapYearPatternType
LEAP_YEAR_15_BASED
Leap year 15-based pattern.
static IslamicChronology.LeapYearPatternType
LEAP_YEAR_16_BASED
Leap year 16-based pattern.
static IslamicChronology.LeapYearPatternType
LEAP_YEAR_HABASH_AL_HASIB
Leap year Habash al-Hasib pattern.
static IslamicChronology.LeapYearPatternType
LEAP_YEAR_INDIAN
Leap year Indian pattern.

Method Summary

protected void
assemble(AssembledChronology.Fields fields)
static IslamicChronology
getInstance()
Gets an instance of the IslamicChronology in the default time zone.
static IslamicChronology
getInstance(DateTimeZone zone)
Gets an instance of the IslamicChronology in the given time zone.
static IslamicChronology
getInstance(DateTimeZone zone, IslamicChronology.LeapYearPatternType leapYears)
Gets an instance of the IslamicChronology in the given time zone.
static IslamicChronology
getInstanceUTC()
Gets an instance of the IslamicChronology.
IslamicChronology.LeapYearPatternType
getLeapYearPatternType()
Gets the leap year pattern type.
int
hashCode()
A suitable hash code for the chronology.
Chronology
withUTC()
Gets the Chronology in the UTC time zone.
Chronology
withZone(DateTimeZone zone)
Gets the Chronology in a specific time zone.

Methods inherited from class org.joda.time.chrono.BasicChronology

assemble, equals, getDateTimeMillis, getDateTimeMillis, getMinimumDaysInFirstWeek, getZone, hashCode, toString

Methods inherited from class org.joda.time.chrono.AssembledChronology

assemble, centuries, centuryOfEra, clockhourOfDay, clockhourOfHalfday, dayOfMonth, dayOfWeek, dayOfYear, days, era, eras, getBase, getDateTimeMillis, getDateTimeMillis, getDateTimeMillis, getParam, getZone, halfdayOfDay, halfdays, hourOfDay, hourOfHalfday, hours, millis, millisOfDay, millisOfSecond, minuteOfDay, minuteOfHour, minutes, monthOfYear, months, secondOfDay, secondOfMinute, seconds, weekOfWeekyear, weeks, weekyear, weekyearOfCentury, weekyears, year, yearOfCentury, yearOfEra, years

Methods inherited from class org.joda.time.chrono.BaseChronology

add, add, centuries, centuryOfEra, clockhourOfDay, clockhourOfHalfday, dayOfMonth, dayOfWeek, dayOfYear, days, era, eras, get, get, get, getDateTimeMillis, getDateTimeMillis, getDateTimeMillis, getZone, halfdayOfDay, halfdays, hourOfDay, hourOfHalfday, hours, millis, millisOfDay, millisOfSecond, minuteOfDay, minuteOfHour, minutes, monthOfYear, months, secondOfDay, secondOfMinute, seconds, set, toString, validate, weekOfWeekyear, weeks, weekyear, weekyearOfCentury, weekyears, withUTC, withZone, year, yearOfCentury, yearOfEra, years

Methods inherited from class org.joda.time.Chronology

add, add, centuries, centuryOfEra, clockhourOfDay, clockhourOfHalfday, dayOfMonth, dayOfWeek, dayOfYear, days, era, eras, get, get, get, getBuddhist, getBuddhist, getBuddhistUTC, getCoptic, getCoptic, getCopticUTC, getDateTimeMillis, getDateTimeMillis, getDateTimeMillis, getGJ, getGJ, getGJUTC, getGregorian, getGregorian, getGregorianUTC, getISO, getISO, getISOUTC, getJulian, getJulian, getJulianUTC, getZone, halfdayOfDay, halfdays, hourOfDay, hourOfHalfday, hours, millis, millisOfDay, millisOfSecond, minuteOfDay, minuteOfHour, minutes, monthOfYear, months, secondOfDay, secondOfMinute, seconds, set, toString, validate, weekOfWeekyear, weeks, weekyear, weekyearOfCentury, weekyears, withUTC, withZone, year, yearOfCentury, yearOfEra, years

Field Details

AH

public static final int AH
Constant value for 'Anno Hegirae', equivalent to the value returned for AD/CE.
Field Value:
1

LEAP_YEAR_15_BASED

public static final IslamicChronology.LeapYearPatternType LEAP_YEAR_15_BASED
Leap year 15-based pattern.

LEAP_YEAR_16_BASED

public static final IslamicChronology.LeapYearPatternType LEAP_YEAR_16_BASED
Leap year 16-based pattern.

LEAP_YEAR_HABASH_AL_HASIB

public static final IslamicChronology.LeapYearPatternType LEAP_YEAR_HABASH_AL_HASIB
Leap year Habash al-Hasib pattern.

LEAP_YEAR_INDIAN

public static final IslamicChronology.LeapYearPatternType LEAP_YEAR_INDIAN
Leap year Indian pattern.

Method Details

assemble

protected void assemble(AssembledChronology.Fields fields)
Overrides:
assemble in interface org.joda.time.chrono.BasicChronology

getInstance

public static IslamicChronology getInstance()
Gets an instance of the IslamicChronology in the default time zone.
Returns:
a chronology in the default time zone

getInstance

public static IslamicChronology getInstance(DateTimeZone zone)
Gets an instance of the IslamicChronology in the given time zone.
Parameters:
zone - the time zone to get the chronology in, null is default
Returns:
a chronology in the specified time zone

getInstance

public static IslamicChronology getInstance(DateTimeZone zone,
                                            IslamicChronology.LeapYearPatternType leapYears)
Gets an instance of the IslamicChronology in the given time zone.
Parameters:
zone - the time zone to get the chronology in, null is default
leapYears - the type defining the leap year pattern
Returns:
a chronology in the specified time zone

getInstanceUTC

public static IslamicChronology getInstanceUTC()
Gets an instance of the IslamicChronology. The time zone of the returned instance is UTC.
Returns:
a singleton UTC instance of the chronology

getLeapYearPatternType

public IslamicChronology.LeapYearPatternType getLeapYearPatternType()
Gets the leap year pattern type.
Returns:
the pattern type

hashCode

public int hashCode()
A suitable hash code for the chronology.
Overrides:
hashCode in interface org.joda.time.chrono.BasicChronology
Returns:
the hash code
Since:
1.6

withUTC

public Chronology withUTC()
Gets the Chronology in the UTC time zone.
Overrides:
withUTC in interface BaseChronology
Returns:
the chronology in UTC

withZone

public Chronology withZone(DateTimeZone zone)
Gets the Chronology in a specific time zone.
Overrides:
withZone in interface BaseChronology
Parameters:
zone - the zone to get the chronology in, null is default
Returns:
the chronology

Copyright (c) 2001-2006 - Joda.org