Mid 2005: Initial release
Apr 2007: reshaped
John Chapman, Kris, schveiguy
- class Gregorian : Calendar ¶
-
Represents the Gregorian calendar.
Note that this is the Proleptic Gregorian calendar. Most calendars assume
that dates before 9/14/1752 were Julian Dates. Julian differs from
Gregorian in that leap years occur every 4 years, even on 100 year
increments. The Proleptic Gregorian calendar applies the Gregorian leap
year rules to dates before 9/14/1752, making the calculation of dates much
easier.
- Gregorian generic [public, gshared, static] ¶
-
- enum ¶
-
Represents the current era.
- static this() [shared] ¶
-
create a generic instance of this calendar
- this(Type type = Localized) ¶
-
Initializes an instance of the Gregorian class using the specified GregorianTypes value. If no value is
specified, the default is Gregorian.Types.Localized.
- Time toTime(uint year, uint month, uint day, uint hour, uint minute, uint second, uint millisecond, uint era) [override, const] ¶
-
Overridden. Returns a Time value set to the specified date and time in the specified _era.
year | An integer representing the _year. |
month | An integer representing the _month. |
day | An integer representing the _day. |
hour | An integer representing the _hour. |
minute | An integer representing the _minute. |
second | An integer representing the _second. |
millisecond | An integer representing the _millisecond. |
era | An integer representing the _era. |
A Time set to the specified date and time.
- DayOfWeek getDayOfWeek(const(Time) time) [override, const] ¶
-
Overridden. Returns the day of the week in the specified Time.
A DayOfWeek value representing the day of the week of time.
- uint getDayOfMonth(const(Time) time) [override, const] ¶
-
Overridden. Returns the day of the month in the specified Time.
An integer representing the day of the month of time.
- uint getDayOfYear(const(Time) time) [override, const] ¶
-
Overridden. Returns the day of the year in the specified Time.
An integer representing the day of the year of time.
- uint getMonth(const(Time) time) [override, const] ¶
-
Overridden. Returns the month in the specified Time.
An integer representing the month in time.
- uint getYear(const(Time) time) [override, const] ¶
-
Overridden. Returns the year in the specified Time.
An integer representing the year in time.
- uint getEra(const(Time) time) [override, const] ¶
-
Overridden. Returns the era in the specified Time.
An integer representing the era in time.
- uint getDaysInMonth(uint year, uint month, uint era) [override, const] ¶
-
Overridden. Returns the number of days in the specified _year and _month of the specified _era.
year | An integer representing the _year. |
month | An integer representing the _month. |
era | An integer representing the _era. |
The number of days in the specified _year and _month of the specified _era.
- uint getDaysInYear(uint year, uint era) [override, const] ¶
-
Overridden. Returns the number of days in the specified _year of the specified _era.
year | An integer representing the _year. |
era | An integer representing the _era. |
The number of days in the specified _year in the specified _era.
- uint getMonthsInYear(uint year, uint era) [override, const] ¶
-
Overridden. Returns the number of months in the specified _year of the specified _era.
year | An integer representing the _year. |
era | An integer representing the _era. |
The number of months in the specified _year in the specified _era.
- bool isLeapYear(uint year, uint era) [override, const] ¶
-
Overridden. Indicates whether the specified _year in the specified _era is a leap _year.
year | An integer representing the _year. |
era | An integer representing the _era. |
true is the specified _year is a leap _year; otherwise, false.
- Type calendarType() [@property, const] ¶
-
Property. Retrieves the GregorianTypes value indicating the language version of the Gregorian.
The Gregorian.Type value indicating the language version of the Gregorian.
- uint[] eras() [@property, override, const] ¶
-
Property. Overridden. Retrieves the list of eras in the current calendar.
An integer array representing the eras in the current calendar.
- uint id() [@property, override, const] ¶
-
Property. Overridden. Retrieves the identifier associated with the current calendar.
An integer representing the identifier of the current calendar.
- void split(const(Time) time, ref uint year, ref uint month, ref uint day, ref uint doy, ref uint dow, ref uint era) [override, const] ¶
-
Overridden. Get the components of a Time structure using the rules
of the calendar. This is useful if you want more than one of the
given components. Note that this doesn't handle the time of day,
as that is calculated directly from the Time struct.
- Time addMonths(const(Time) t, int nMonths, bool truncateDay = false) [override, const] ¶
-
Overridden. Returns a new Time with the specified number of months
added. If the months are negative, the months are subtracted.
If the target month does not support the day component of the input
time, then an error will be thrown, unless truncateDay is set to
true. If truncateDay is set to true, then the day is reduced to
the maximum day of that month.
For example, adding one month to 1/31/2000 with truncateDay set to
true results in 2/28/2000.
t | A time to add the months to |
nMonths | The number of months to add. This can be
negative. |
truncateDay | Round the day down to the maximum day of the
target month if necessary. |
A Time that represents the provided time with the number
of months added.
- Time addYears(const(Time) t, int nYears) [override, const] ¶
-
Overridden. Add the specified number of years to the given Time.
Note that the Gregorian calendar takes into account that BC time
is negative, and supports crossing from BC to AD.
t | A time to add the years to |
nYears | The number of years to add. This can be negative. |
A Time that represents the provided time with the number
of years added.