Noda Time
CalendarSystem Class
NamespacesNodaTimeCalendarSystem

[This is preliminary documentation and is subject to change.]

A calendar system maps the non-calendar-specific "local time line" to human concepts such as years, months and days.
Declaration Syntax
C#Visual BasicVisual C++
public abstract class CalendarSystem
Public MustInherit Class CalendarSystem
public ref class CalendarSystem abstract
Members
All MembersMethodsProperties



IconMemberDescription
Eras
Returns a read-only list of eras used in this calendar system.

ForId(String)
Fetches a calendar system by its unique identifier. This provides full round-tripping of a calendar system. It is not guaranteed that calling this method twice with the same identifier will return identical references, but the references objects will be equal.

GetAbsoluteYear(Int32, Era)
Returns the "absolute year" (the one used throughout most of the API, without respect to eras) from a year-of-era and an era.

GetCopticCalendar(Int32)
Returns a Coptic calendar system, which defines every fourth year as leap, much like the Julian calendar. The year is broken down into 12 months, each 30 days in length. An extra period at the end of the year is either 5 or 6 days in length. In this implementation, it is considered a 13th month.

GetDaysInMonth(Int32, Int32)
Returns the number of days in the given month within the given year.

GetGregorianCalendar(Int32)
Returns a pure proleptic Gregorian calendar system, which defines every fourth year as leap, unless the year is divisible by 100 and not by 400. This improves upon the Julian calendar leap year rule.

GetIslamicCalendar(IslamicLeapYearPattern, IslamicEpoch)
Returns an Islamic, or Hijri, calendar system.

GetJulianCalendar(Int32)
Returns a pure proleptic Julian calendar system, which defines every fourth year as a leap year. This implementation follows the leap year rule strictly, even for dates before 8 CE, where leap years were actually irregular.

GetMaxMonth(Int32)
The maximum valid month (inclusive) within this calendar in the given year. It is assumed that all calendars start with month 1 and go up to this month number in any valid year.

GetMaxYearOfEra(Era)
Returns the maximum valid year-of-era in the given era.

GetMinYearOfEra(Era)
Returns the minimum valid year-of-era in the given era.

Id
Returns the unique identifier for this calendar system. This is provides full round-trip capability using ForId(String) to retrieve the calendar system from the identifier.

Ids
Returns the IDs of all calendar systems available within Noda Time. The order of the keys is not guaranteed.

IsLeapYear(Int32)
Returns whether or not the given year is a leap year in this calendar.

Iso
Returns a calendar system that follows the rules of the ISO-8601 standard, which is compatible with Gregorian for all modern dates.

MaxYear
The maximum valid year (inclusive) within this calendar.

MinYear
The minimum valid year (inclusive) within this calendar.

Name
Returns the name of this calendar system. Each kind of calendar system has a unique name, but this does not usually provide enough information for round-tripping. (For example, the name of an Islamic calendar system does not indicate which kind of leap cycle it uses, and other calendars specify the minimum number of days in the first week of a year.)

ToString()()()()
Converts this calendar system to text by simply returning its unique ID.
(Overrides Object.ToString()()()().)
UsesIsoDayOfWeek
Returns whether the day-of-week field refers to ISO days. If true, types such as LocalDateTime can use the IsoDayOfWeek property to avoid using magic numbers. This defaults to true, but can be overridden by specific calendars.

Remarks

Many developers will never need to touch this class, other than to potentially ask a calendar how many days are in a particular year/month and the like. Noda Time defaults to using the ISO-8601 calendar anywhere that a calendar system is required but hasn't been explicitly specified.

If you need to obtain a CalendarSystem instance, use one of the static properties or methods in this class, such as the Iso property or the GetGregorianCalendar(Int32) method.

Although this class is abstract, other assemblies cannot introduce types which derive from it, as the constructor is internal, and makes use of internal types. This ensures that all calendar types are genuinely immutable and thread-safe, aside from anything else. If you require a calendar system which is not currently supported, please file a feature request and we'll see what we can do.

Thread Safety
All calendar implementations within Noda Time are immutable and thread-safe. See the thread safety section of the user guide for more information.
Inheritance Hierarchy
Object
CalendarSystem

Assembly: NodaTime (Module: NodaTime.dll) Version: 1.2.0.0 (1.2.0)