tango.time.chrono.Gregorian

License:
BSD style:

Version:
Mid 2005: Initial release Apr 2007: reshaped

author:
John Chapman, Kris, schveiguy

class Gregorian: tango.time.chrono.Calendar.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.

static Gregorian generic;
static shared instance

this(Type 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.

const const Time toTime(uint year, uint month, uint day, uint hour, uint minute, uint second, uint millisecond, uint era);
Overridden. Returns a Time value set to the specified date and time in the specified era.

Params:
uint year An integer representing the year.
uint month An integer representing the month.
uint day An integer representing the day.
uint hour An integer representing the hour.
uint minute An integer representing the minute.
uint second An integer representing the second.
uint millisecond An integer representing the millisecond.
uint era An integer representing the era.

Returns:
A Time set to the specified date and time.

const const DayOfWeek getDayOfWeek(const(Time) time);
Overridden. Returns the day of the week in the specified Time.

Params:
const(Time) time A Time value.

Returns:
A DayOfWeek value representing the day of the week of time.

const const uint getDayOfMonth(const(Time) time);
Overridden. Returns the day of the month in the specified Time.

Params:
const(Time) time A Time value.

Returns:
An integer representing the day of the month of time.

const const uint getDayOfYear(const(Time) time);
Overridden. Returns the day of the year in the specified Time.

Params:
const(Time) time A Time value.

Returns:
An integer representing the day of the year of time.

const const uint getMonth(const(Time) time);
Overridden. Returns the month in the specified Time.

Params:
const(Time) time A Time value.

Returns:
An integer representing the month in time.

const const uint getYear(const(Time) time);
Overridden. Returns the year in the specified Time.

Params:
const(Time) time A Time value.

Returns:
An integer representing the year in time.

const const uint getEra(const(Time) time);
Overridden. Returns the era in the specified Time.

Params:
const(Time) time A Time value.

Returns:
An integer representing the era in time.

const const uint getDaysInMonth(uint year, uint month, uint era);
Overridden. Returns the number of days in the specified year and month of the specified era.

Params:
uint year An integer representing the year.
uint month An integer representing the month.
uint era An integer representing the era.

Returns:
The number of days in the specified year and month of the specified era.

const const uint getDaysInYear(uint year, uint era);
Overridden. Returns the number of days in the specified year of the specified era.

Params:
uint year An integer representing the year.
uint era An integer representing the era.

Returns:
The number of days in the specified year in the specified era.

const const uint getMonthsInYear(uint year, uint era);
Overridden. Returns the number of months in the specified year of the specified era.

Params:
uint year An integer representing the year.
uint era An integer representing the era.

Returns:
The number of months in the specified year in the specified era.

const const bool isLeapYear(uint year, uint era);
Overridden. Indicates whether the specified year in the specified era is a leap year.

Params:
uint year An integer representing the year.

Params:
uint era An integer representing the era.

Returns:
true is the specified year is a leap year; otherwise, false.

const const @property Type calendarType();
Property. Retrieves the GregorianTypes value indicating the language version of the Gregorian.

Returns:
The Gregorian.Type value indicating the language version of the Gregorian.

const const @property uint[] eras();
Property. Overridden. Retrieves the list of eras in the current calendar.

Returns:
An integer array representing the eras in the current calendar.

const const @property uint id();
Property. Overridden. Retrieves the identifier associated with the current calendar.

Returns:
An integer representing the identifier of the current calendar.

const const void split(const(Time) time, ref uint year, ref uint month, ref uint day, ref uint doy, ref uint dow, ref uint era);
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.

const const Time addMonths(const(Time) t, int nMonths, bool truncateDay = false);
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.

Params:
const(Time) t A time to add the months to

Params:
int nMonths The number of months to add. This can be negative.

Params:
bool truncateDay Round the day down to the maximum day of the target month if necessary.

Returns:
A Time that represents the provided time with the number of months added.

const const Time addYears(const(Time) t, int nYears);
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.

Params:
const(Time) t A time to add the years to

Params:
int nYears The number of years to add. This can be negative.

Returns:
A Time that represents the provided time with the number of years added.


Page generated by Ddoc. Copyright (c) 2005 John Chapman. All rights reserved