Rogue Wave Views |
Rogue Wave Views Documentation Home |
Class that provides the standard calendar used by most of the world. More...
#include <ilog/gregocal.h>
Public Types | |
enum | EEras { BC, AD } |
Useful constants for IlGregorianCalendar and IlTimeZone . More... | |
Public Types inherited from IlCalendar | |
enum | EAmpm { AM, PM } |
Constants for the hour in a 12-hour clock. More... | |
enum | EDaysOfWeek { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } |
Constants for days of the week. More... | |
enum | EMonths { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER, UNDECIMBER } |
Constants for the month. More... | |
enum | IlDateFields { ERA, YEAR, MONTH, WEEK_OF_YEAR, WEEK_OF_MONTH, DATE, DAY_OF_YEAR, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND, ZONE_OFFSET, DST_OFFSET } |
Field IDs for date and time. More... | |
Public Member Functions | |
IlGregorianCalendar (IlDateErrorCode &success) | |
Constructs a default IlGregorianCalendar . More... | |
IlGregorianCalendar (IlTimeZone *zoneToAdopt, IlDateErrorCode &success) | |
Constructs an IlGregorianCalendar with the given time zone. More... | |
IlGregorianCalendar (const IlTimeZone &zone, IlDateErrorCode &success) | |
Constructs an IlGregorianCalendar with the given time zone. More... | |
IlGregorianCalendar (const IlLocale &aLocale, IlDateErrorCode &success) | |
Constructs a IlGregorianCalendar with the given locale. More... | |
IlGregorianCalendar (IlTimeZone *zoneToAdopt, const IlLocale &aLocale, IlDateErrorCode &success) | |
Constructs an IlGregorianCalendar with the given time zone and locale. More... | |
IlGregorianCalendar (const IlTimeZone &zone, const IlLocale &aLocale, IlDateErrorCode &success) | |
Constructs a IlGregorianCalendar in the given time zone with the given locale. More... | |
IlGregorianCalendar (IlInt year, IlInt month, IlInt date, IlDateErrorCode &success) | |
Constructs an IlGregorianCalendar with the given AD date. More... | |
IlGregorianCalendar (IlInt year, IlInt month, IlInt date, IlInt hour, IlInt minute, IlDateErrorCode &success) | |
Constructs an IlGregorianCalendar with the given AD date and time. More... | |
IlGregorianCalendar (IlInt year, IlInt month, IlInt date, IlInt hour, IlInt minute, IlInt second, IlDateErrorCode &success) | |
Constructs an IlGregorianCalendar with the given AD date and time. More... | |
IlGregorianCalendar (const IlGregorianCalendar &source) | |
Copy constructor. | |
virtual | ~IlGregorianCalendar () |
Destructor. | |
virtual void | add (IlDateFields field, IlInt amount, IlDateErrorCode &status) |
Adds the specified (signed) amount of time to the given time field, based on the calendar rules. More... | |
virtual IlCalendar * | clone (void) const |
Creates and returns a polymorphic copy of this calendar. | |
virtual IlBoolean | equivalentTo (const IlCalendar &other) const |
IlCalendar override. More... | |
IlInt | getActualMaximum (IlDateFields field) const |
Returns the maximum value that this field could have, given the current date. More... | |
IlInt | getActualMinimum (IlDateFields field) const |
Returns the minimum value that this field could have, given the current date. More... | |
virtual IlInt | getGreatestMinimum (IlDateFields field) const |
Returns the highest minimum value for the given field if varies. More... | |
IlDate | getGregorianChange (void) const |
Gets the IlGregorianCalendar change date. More... | |
virtual IlInt | getLeastMaximum (IlDateFields field) const |
Returns the lowest maximum value for the given field if varies. More... | |
virtual IlInt | getMaximum (IlDateFields field) const |
Returns the maximum value for the given field. More... | |
virtual IlInt | getMinimum (IlDateFields field) const |
Returns the minimum value for the given field. More... | |
virtual IlBoolean | inDaylightTime (IlDateErrorCode &status) const |
Returns IlTrue if the current date for this IlCalendar is in Daylight Savings Time. More... | |
IlBoolean | isLeapYear (IlInt year) const |
Returns IlTrue if the given year is a leap year. More... | |
IlGregorianCalendar & | operator= (const IlGregorianCalendar &right) |
Default assignment operator. | |
virtual IlBoolean | operator== (const IlCalendar &that) const |
Compares the equality of two IlGregorianCalendar objects. More... | |
virtual void | roll (IlDateFields field, IlInt amount, IlDateErrorCode &status) |
Rolls up or down by the given amount in the specified field. More... | |
void | setGregorianChange (IlDate date, IlDateErrorCode &success) |
Sets the IlGregorianCalendar change date. More... | |
Public Member Functions inherited from IlCalendar | |
virtual | ~IlCalendar () |
Destructor. | |
void | adoptTimeZone (IlTimeZone *value) |
Sets the calendar time zone to be the one passed in. More... | |
IlBoolean | after (const IlCalendar &when, IlDateErrorCode &status) const |
Returns IlTrue if this IlCalendar current time is after when current time. More... | |
IlBoolean | before (const IlCalendar &when, IlDateErrorCode &status) const |
Returns IlTrue if this IlCalendar current time is before when current time. More... | |
void | clear () |
Clears the values of all the time fields, making them both unset and assigning them a value of zero. More... | |
void | clear (IlDateFields field) |
Clears the value in the given time field, both making it unset and assigning it a value of zero. More... | |
IlBoolean | equals (const IlCalendar &when, IlDateErrorCode &status) const |
Compares the IlCalendar time, whereas IlCalendar::operator== compares the equality of IlCalendar objects. More... | |
virtual IlInt | fieldDifference (IlDate when, IlDateFields field, IlDateErrorCode &status) |
Returns the difference between the given time and the time this calendar object is set to. More... | |
IlInt | get (IlDateFields field, IlDateErrorCode &status) const |
Indicates the value for a given time field. More... | |
IlInt | getActualMaximum (IlDateFields field, IlDateErrorCode &status) const |
Returns the maximum value that this field could have, given the current date. More... | |
IlInt | getActualMinimum (IlDateFields field, IlDateErrorCode &status) const |
Returns the minimum value that this field could have, given the current date. More... | |
EDaysOfWeek | getFirstDayOfWeek () const |
Returns the first day of the week; for example, Sunday in US, Monday in France. More... | |
IlUChar | getMinimalDaysInFirstWeek () const |
Indicates the minimal days required in the first week of the year. More... | |
IlDate | getTime (IlDateErrorCode &status) const |
Gets this IlCalendar time as milliseconds. More... | |
const IlTimeZone & | getTimeZone () const |
Returns a reference to the time zone owned by this calendar. More... | |
IlBoolean | isLenient () const |
Indicates whether the date/time interpretation is lenient. More... | |
IlBoolean | isSet (IlDateFields field) const |
Determines if the given time field has a value set. More... | |
IlBoolean | operator!= (const IlCalendar &that) const |
Compares the inequality of two IlCalendar objects. More... | |
IlTimeZone * | orphanTimeZone () |
Returns the time zone owned by this calendar. More... | |
void | roll (IlDateFields field, IlBoolean up, IlDateErrorCode &status) |
Time Field Rolling function: rolls (up/down) a single unit of time on the given time field. More... | |
void | set (IlDateFields field, IlInt value) |
Sets the given time field with the given value. More... | |
void | set (IlInt year, IlInt month, IlInt date) |
Sets the values for the fields YEAR , MONTH , and DATE . More... | |
void | set (IlInt year, IlInt month, IlInt date, IlInt hour, IlInt minute) |
Sets the values for the fields YEAR , MONTH , DATE , HOUR_OF_DAY , and MINUTE . More... | |
void | set (IlInt year, IlInt month, IlInt date, IlInt hour, IlInt minute, IlInt second) |
Sets the values for the fields YEAR , MONTH , DATE , HOUR_OF_DAY , MINUTE , and SECOND . More... | |
void | setFirstDayOfWeek (EDaysOfWeek value) |
Sets the first day of the week; for example, Sunday in US, Monday in France. More... | |
void | setLenient (IlBoolean lenient) |
Specifies whether or not the date/time interpretation is to be lenient. More... | |
void | setMinimalDaysInFirstWeek (IlUChar value) |
Sets the minimal days required in the first week of the year. More... | |
void | setTime (IlDate date, IlDateErrorCode &status) |
Sets this IlCalendar current time with the given IlDate . More... | |
void | setTimeZone (const IlTimeZone &zone) |
Sets the calendar time zone to be the same as the one passed in. More... | |
Protected Member Functions | |
virtual void | computeFields (IlDateErrorCode &status) |
Converts GMT as milliseconds to time field values. More... | |
virtual void | computeTime (IlDateErrorCode &status) |
Converts IlCalendar time field values to GMT as milliseconds. More... | |
Protected Member Functions inherited from IlCalendar | |
IlCalendar (IlDateErrorCode &success) | |
Constructs an IlCalendar with the default time zone and locale. More... | |
IlCalendar (const IlCalendar &source) | |
Copy constructor. More... | |
IlCalendar (IlTimeZone *zone, const IlLocale &locale, IlDateErrorCode &success) | |
Initializes a new IlCalendar with the given time zone and locale. More... | |
IlCalendar (const IlTimeZone &zone, const IlLocale &locale, IlDateErrorCode &success) | |
Initializes a new IlCalendar with the given time zone and locale. More... | |
void | complete (IlDateErrorCode &status) |
Recomputes the current time from currently set fields. More... | |
double | getTimeInMillis (IlDateErrorCode &status) const |
Gets this IlCalendar current time as a long. More... | |
IlInt | internalGet (IlDateFields field) const |
Gets the value for a given time field. More... | |
IlDate | internalGetTime () const |
void | internalSet (IlDateFields field, IlInt value) |
Sets the value for a given time field. More... | |
void | internalSetTime (IlDate time) |
IlCalendar & | operator= (const IlCalendar &right) |
The default assignment operator. | |
void | setTimeInMillis (double millis, IlDateErrorCode &status) |
Sets this IlCalendar current time from the given long value. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from IlCalendar | |
static IlCalendar * | createInstance (IlDateErrorCode &success) |
Creates an IlCalendar that uses the default time zone and locale. More... | |
static IlCalendar * | createInstance (IlTimeZone *zoneToAdopt, IlDateErrorCode &success) |
Creates an IlCalendar using the given time zone and the default locale. More... | |
static IlCalendar * | createInstance (const IlTimeZone &zone, IlDateErrorCode &success) |
Creates an IlCalendar using the given time zone and the default locale. More... | |
static IlCalendar * | createInstance (const IlLocale &aLocale, IlDateErrorCode &success) |
Creates an IlCalendar using the default time zone and the given locale. More... | |
static IlCalendar * | createInstance (IlTimeZone *zoneToAdopt, const IlLocale &aLocale, IlDateErrorCode &success) |
Creates an IlCalendar using the given time zone and locale. More... | |
static IlCalendar * | createInstance (const IlTimeZone &zoneToAdopt, const IlLocale &aLocale, IlDateErrorCode &success) |
Gets an IlCalendar using the given time zone and given locale. More... | |
static IlDate | getNow () |
Returns the current UTC (GMT) time measured in milliseconds since 0:00:00 on 1/1/70 (derived from the system time). More... | |
Protected Attributes inherited from IlCalendar | |
IlBoolean | fAreAllFieldsSet |
IlBoolean | fAreFieldsSet |
IlInt | fFields [FIELD_COUNT] |
IlBoolean | fIsSet [FIELD_COUNT] |
IlBoolean | fIsTimeSet |
IlInt | fStamp [FIELD_COUNT] |
Class that provides the standard calendar used by most of the world.
Library: ilog
From IBM ICU classes, adapted for Rogue Wave Views libraries.
Copyright (C) 1997-1999, International Business Machines Corporation and others. All Rights Reserved.
The standard (Gregorian) calendar has 2 eras, BC
and AD
.
This implementation handles a single discontinuity, which corresponds by default to the date the Gregorian calendar was originally instituted (October 15, 1582). Not all countries adopted the Gregorian calendar then, so this cutover date may be changed by the caller.
Prior to the institution of the Gregorian calendar, New Year's Day was March 25. To avoid confusion, this IlCalendar
always uses January 1. A manual adjustment may be made if desired for dates that are prior to the Gregorian changeover and which fall between January 1 and March 24.
Values calculated for the WEEK_OF_YEAR
field range from 1 to 53. Week 1 for a year is the first week that contains at least getMinimalDaysInFirstWeek()
days from that year. It thus depends on the values of getMinimalDaysInFirstWeek()
, getFirstDayOfWeek()
, and the day of the week of January 1. Weeks between week 1 of one year and week 1 of the following year are numbered sequentially from 2 to 52 or 53 (as needed).
For example, January 1, 1998 was a Thursday. If getFirstDayOfWeek()
is MONDAY
and getMinimalDaysInFirstWeek()
is 4
(these are the values reflecting ISO 8601 and many national standards), then week 1 of 1998 starts on December 29, 1997, and ends on January 4, 1998. If, however, getFirstDayOfWeek()
is SUNDAY
, then week 1 of 1998 starts on January 4, 1998, and ends on January 10, 1998; the first three days of 1998 then are part of week 53 of 1997.
Example for using IlGregorianCalendar
:
// get the supported ids for GMT-08:00 (Pacific Standard Time) IlInt idsCount; const UnicodeString** ids = IlTimeZone::createAvailableIDs(-8 * 60 * 60 * 1000, idsCount); // if no ids were returned, something is wrong. get out. if (idsCount == 0) { return; }
// begin output cout << "Current Time" << endl;
// create a Pacific Standard Time time zone SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, *(ids[0]));
// set up rules for daylight savings time pdt->setStartRule(IlCalendar::APRIL, 1, IlCalendar::SUNDAY, 2 * 60 * 60 * 1000); pdt->setEndRule(IlCalendar::OCTOBER, -1, IlCalendar::SUNDAY, 2 * 60 * 60 * 1000);
// create a IlGregorianCalendar with the Pacific Daylight time zone // and the current date and time IlDateErrorCode success = IL_DATE_ZERO_ERROR; IlCalendar* calendar = new IlGregorianCalendar(pdt, success);
// print out a bunch of interesting things cout << "ERA: " << calendar->get(IlCalendar::ERA, success) << endl; cout << "YEAR: " << calendar->get(IlCalendar::YEAR, success) << endl; cout << "MONTH: " << calendar->get(IlCalendar::MONTH, success) << endl; cout << "WEEK_OF_YEAR: " << calendar->get(IlCalendar::WEEK_OF_YEAR, success) << endl; cout << "WEEK_OF_MONTH: " << calendar->get(IlCalendar::WEEK_OF_MONTH, success) << endl; cout << "DATE: " << calendar->get(IlCalendar::DATE, success) << endl; cout << "DAY_OF_MONTH: " << calendar->get(IlCalendar::DAY_OF_MONTH, success) << endl; cout << "DAY_OF_YEAR: " << calendar->get(IlCalendar::DAY_OF_YEAR, success) << endl; cout << "DAY_OF_WEEK: " << calendar->get(IlCalendar::DAY_OF_WEEK, success) << endl; cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get(IlCalendar::DAY_OF_WEEK_IN_MONTH, success) << endl; cout << "AM_PM: " << calendar->get(IlCalendar::AM_PM, success) << endl; cout << "HOUR: " << calendar->get(IlCalendar::HOUR, success) << endl; cout << "HOUR_OF_DAY: " << calendar->get(IlCalendar::HOUR_OF_DAY, success) << endl; cout << "MINUTE: " << calendar->get(IlCalendar::MINUTE, success) << endl; cout << "SECOND: " << calendar->get(IlCalendar::SECOND, success) << endl; cout << "MILLISECOND: " << calendar->get(IlCalendar::MILLISECOND, success) << endl; cout << "ZONE_OFFSET: " << (calendar->get(IlCalendar::ZONE_OFFSET, success)/(60*60*1000)) << endl; cout << "DST_OFFSET: " << (calendar->get(IlCalendar::DST_OFFSET, success)/(60*60*1000)) << endl;
cout << "Current Time, with hour reset to 3" << endl; calendar->clear(IlCalendar::HOUR_OF_DAY); // so doesn't override calendar->set(IlCalendar::HOUR, 3); cout << "ERA: " << calendar->get(IlCalendar::ERA, success) << endl; cout << "YEAR: " << calendar->get(IlCalendar::YEAR, success) << endl; cout << "MONTH: " << calendar->get(IlCalendar::MONTH, success) << endl; cout << "WEEK_OF_YEAR: " << calendar->get(IlCalendar::WEEK_OF_YEAR, success) << endl; cout << "WEEK_OF_MONTH: " << calendar->get(IlCalendar::WEEK_OF_MONTH, success) << endl; cout << "DATE: " << calendar->get(IlCalendar::DATE, success) << endl; cout << "DAY_OF_MONTH: " << calendar->get(IlCalendar::DAY_OF_MONTH, success) << endl; cout << "DAY_OF_YEAR: " << calendar->get(IlCalendar::DAY_OF_YEAR, success) << endl; cout << "DAY_OF_WEEK: " << calendar->get(IlCalendar::DAY_OF_WEEK, success) << endl; cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get(IlCalendar::DAY_OF_WEEK_IN_MONTH, success) << endl; cout << "AM_PM: " << calendar->get(IlCalendar::AM_PM, success) << endl; cout << "HOUR: " << calendar->get(IlCalendar::HOUR, success) << endl; cout << "HOUR_OF_DAY: " << calendar->get(IlCalendar::HOUR_OF_DAY, success) << endl; cout << "MINUTE: " << calendar->get(IlCalendar::MINUTE, success) << endl; cout << "SECOND: " << calendar->get(IlCalendar::SECOND, success) << endl; cout << "MILLISECOND: " << calendar->get(IlCalendar::MILLISECOND, success) << endl; cout << "ZONE_OFFSET: " << (calendar->get(IlCalendar::ZONE_OFFSET, success)/(60*60*1000)) << endl; // in hours cout << "DST_OFFSET: " << (calendar->get(IlCalendar::DST_OFFSET, success)/(60*60*1000)) << endl; // in hours
delete[] ids; delete calendar; // also deletes pdt
Useful constants for IlGregorianCalendar
and IlTimeZone
.
Enumerator | |
---|---|
BC |
Used to specify a year before the supposed year of the birth of Christ. |
AD |
Used to specify a year after the supposed year of the birth of Christ. |
IlGregorianCalendar::IlGregorianCalendar | ( | IlDateErrorCode & | success | ) |
Constructs a default IlGregorianCalendar
.
The object is constructed using the current time in the default time zone with the default locale.
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
IlGregorianCalendar::IlGregorianCalendar | ( | IlTimeZone * | zoneToAdopt, |
IlDateErrorCode & | success | ||
) |
Constructs an IlGregorianCalendar
with the given time zone.
The object is based on the current time in the given time zone with the default locale. Clients are no longer responsible for deleting the given time zone object after it is adopted.
zoneToAdopt | The given time zone. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
IlGregorianCalendar::IlGregorianCalendar | ( | const IlTimeZone & | zone, |
IlDateErrorCode & | success | ||
) |
Constructs an IlGregorianCalendar
with the given time zone.
The object is based on the current time in the given time zone with the default locale.
zone | The given time zone. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
IlGregorianCalendar::IlGregorianCalendar | ( | const IlLocale & | aLocale, |
IlDateErrorCode & | success | ||
) |
Constructs a IlGregorianCalendar
with the given locale.
The object is based on the current time in the default time zone.
aLocale | The given locale. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
IlGregorianCalendar::IlGregorianCalendar | ( | IlTimeZone * | zoneToAdopt, |
const IlLocale & | aLocale, | ||
IlDateErrorCode & | success | ||
) |
Constructs an IlGregorianCalendar
with the given time zone and locale.
The object is based on the current time. Clients are no longer responsible for deleting the given time zone object after it is adopted.
zoneToAdopt | The given time zone. |
aLocale | The given locale. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
IlGregorianCalendar::IlGregorianCalendar | ( | const IlTimeZone & | zone, |
const IlLocale & | aLocale, | ||
IlDateErrorCode & | success | ||
) |
Constructs a IlGregorianCalendar
in the given time zone with the given locale.
The object is based on the current time.
zone | The given time zone. |
aLocale | The given locale. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
IlGregorianCalendar::IlGregorianCalendar | ( | IlInt | year, |
IlInt | month, | ||
IlInt | date, | ||
IlDateErrorCode & | success | ||
) |
Constructs an IlGregorianCalendar
with the given AD
date.
The object is set in the default time zone with the default locale.
year | The value used to set the YEAR time field in the calendar. |
month | The value used to set the MONTH time field in the calendar. The month value is 0-based, for example, 0 for January. |
date | The value used to set the DATE time field in the calendar. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
validateFields
function. This function returns IlTrue
if the date is valid. IlGregorianCalendar::IlGregorianCalendar | ( | IlInt | year, |
IlInt | month, | ||
IlInt | date, | ||
IlInt | hour, | ||
IlInt | minute, | ||
IlDateErrorCode & | success | ||
) |
Constructs an IlGregorianCalendar
with the given AD
date and time.
The object is set for the default time zone with the default locale.
year | The value used to set the YEAR time field in the calendar. |
month | The value used to set the MONTH time field in the calendar. The month value is 0-based, for example, 0 for January. |
date | The value used to set the DATE time field in the calendar. |
hour | The value used to set the HOUR_OF_DAY time field in the calendar. |
minute | The value used to set the MINUTE time field in the calendar. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
validateFields
function. This function returns IlTrue
if the date is valid. IlGregorianCalendar::IlGregorianCalendar | ( | IlInt | year, |
IlInt | month, | ||
IlInt | date, | ||
IlInt | hour, | ||
IlInt | minute, | ||
IlInt | second, | ||
IlDateErrorCode & | success | ||
) |
Constructs an IlGregorianCalendar
with the given AD
date and time.
The object is set for the default time zone with the default locale.
year | The value used to set the YEAR time field in the calendar. |
month | The value used to set the MONTH time field in the calendar. The month value is 0-based, for example, 0 for January. |
date | The value used to set the DATE time field in the calendar. |
hour | The value used to set the HOUR_OF_DAY time field in the calendar. |
minute | The value used to set the MINUTE time field in the calendar. |
second | The value used to set the SECOND time field in the calendar. |
success | Indicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully. |
validateFields
function. This function returns IlTrue
if the date is valid.
|
virtual |
Adds the specified (signed) amount of time to the given time field, based on the calendar rules.
(Overrides IlCalendar
) IlDate
Arithmetic function.
field | The time field. |
amount | The amount of date or time to be added to the field. |
status | The output param is set to success/failure code on exit. If any value previously set in the time field is invalid, it will be set to an error status. |
IlCalendar::add()
. Implements IlCalendar.
|
protectedvirtual |
|
protectedvirtual |
Converts IlCalendar
time field values to GMT as milliseconds.
(Overrides IlCalendar
)
status | The output param set to success/failure code on exit. If any value previously set in the time field is invalid, it will be set to an error status. |
Implements IlCalendar.
|
virtual |
IlCalendar
override.
IlTrue
if another IlCalendar
object is equivalent to this one. An equivalent IlCalendar
will behave exactly as this one does, but may be set to a different time. Reimplemented from IlCalendar.
IlInt IlGregorianCalendar::getActualMaximum | ( | IlDateFields | field | ) | const |
Returns the maximum value that this field could have, given the current date.
For example, with the date Feb 3, 1997
and the DAY_OF_MONTH
field, the actual maximum would be 28
; for Feb 3, 1996
it is 29
. Similarly for a Hebrew calendar, for some years the actual maximum for MONTH
is 12
, and for others 13
.
IlInt IlGregorianCalendar::getActualMinimum | ( | IlDateFields | field | ) | const |
Returns the minimum value that this field could have, given the current date.
For the Gregorian calendar, this is the same as getMinimum()
and getGreatestMinimum()
.
|
virtual |
Returns the highest minimum value for the given field if varies.
Otherwise it is the same as getMinimum()
. For Gregorian, there is no difference. (Overrides IlCalendar
)
Implements IlCalendar.
IlDate IlGregorianCalendar::getGregorianChange | ( | void | ) | const |
Gets the IlGregorianCalendar
change date.
This is the point when the switch from Julian dates to Gregorian dates occurred. Default is 00:00:00
local time, October 15, 1582
. Prior to this time and date are Julian dates.
|
virtual |
Returns the lowest maximum value for the given field if varies.
Otherwise it is the same as getMaximum()
. For Gregorian DAY_OF_MONTH
, 28
. (Overrides IlCalendar
).
Implements IlCalendar.
|
virtual |
Returns the maximum value for the given field.
For example, for Gregorian DAY_OF_MONTH
, 31
. (Overrides IlCalendar
).
Implements IlCalendar.
|
virtual |
Returns the minimum value for the given field.
For example, for Gregorian DAY_OF_MONTH
, 1
. (Overrides IlCalendar
)
Implements IlCalendar.
|
virtual |
Returns IlTrue
if the current date for this IlCalendar
is in Daylight Savings Time.
Recognizes DST_OFFSET
, if it is set. (Overrides IlCalendar
)
status | Fill-in parameter which receives the status of this operation. |
IlTrue
if the current date for this IlCalendar
is in Daylight Savings Time. Otherwise, it is set to IlFalse
. Implements IlCalendar.
Returns IlTrue
if the given year is a leap year.
Determination of whether a year is a leap year is actually very complicated. We do something crude and mostly correct here, but for a real determination you need a lot of contextual information. For example, in Sweden, the change from Julian to Gregorian happened in a complex way resulting in missed leap years and double leap years between 1700 and 1753. Another example is that after the start of the Julian calendar in 45 B.C., the leap years did not regularize until 8 A.D. This method ignores these quirks, and pays attention only to the Julian onset date and the Gregorian cutover (which can be changed).
year | The given year. |
IlTrue
if the given year is a leap year; IlFalse
otherwise.
|
virtual |
Compares the equality of two IlGregorianCalendar
objects.
Objects of different subclasses are considered unequal. This is a strict equality test.
IlCalendar::operator==()
that | The IlGregorianCalendar object to be compared with. |
IlTrue
if the given IlGregorianCalendar
is the same as this IlGregorianCalendar
, otherwise IlFalse
. Reimplemented from IlCalendar.
|
virtual |
Rolls up or down by the given amount in the specified field.
(Overrides IlCalendar
)
field | The time field. |
amount | Indicates amount to roll. |
status | The output param is set to success/failure code on exit. If any value previously set in the time field is invalid, it will be set to an error status. |
IlCalendar::roll()
. Implements IlCalendar.
void IlGregorianCalendar::setGregorianChange | ( | IlDate | date, |
IlDateErrorCode & | success | ||
) |
Sets the IlGregorianCalendar
change date.
The change date is the point when the switch from Julian dates to Gregorian dates occurred. Default is 00:00:00
local time, October 15, 1582
. Prior to this time and date are Julian dates.
date | The given Gregorian cutover date. |
success | Output param set to success/failure code on exit. |
© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.