Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Types | Public Member Functions | Protected Member Functions
IlGregorianCalendar Class Reference

Class that provides the standard calendar used by most of the world. More...

#include <ilog/gregocal.h>

Inheritance diagram for IlGregorianCalendar:
IlCalendar

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 IlCalendarclone (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...
 
IlGregorianCalendaroperator= (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 IlTimeZonegetTimeZone () 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...
 
IlTimeZoneorphanTimeZone ()
 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...
 
IlDate set (const char *date, IlDateErrorCode &status)
 Sets the date from the provided ISO 8601 string. 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
 Gets the current time without recomputing.
 
void internalSet (IlDateFields field, IlInt value)
 Sets the value for a given time field. More...
 
void internalSetTime (IlDate time)
 Sets the current time without affecting flags or fields.
 
IlCalendaroperator= (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 IlCalendarcreateInstance (IlDateErrorCode &success)
 Creates an IlCalendar that uses the default time zone and locale. More...
 
static IlCalendarcreateInstance (IlTimeZone *zoneToAdopt, IlDateErrorCode &success)
 Creates an IlCalendar using the given time zone and the default locale. More...
 
static IlCalendarcreateInstance (const IlTimeZone &zone, IlDateErrorCode &success)
 Creates an IlCalendar using the given time zone and the default locale. More...
 
static IlCalendarcreateInstance (const IlLocale &aLocale, IlDateErrorCode &success)
 Creates an IlCalendar using the default time zone and the given locale. More...
 
static IlCalendarcreateInstance (IlTimeZone *zoneToAdopt, const IlLocale &aLocale, IlDateErrorCode &success)
 Creates an IlCalendar using the given time zone and locale. More...
 
static IlCalendarcreateInstance (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
 Indicates if all of the fields have been set. More...
 
IlBoolean fAreFieldsSet
 
IlInt fFields [FIELD_COUNT]
 
IlBoolean fIsSet [FIELD_COUNT]
 
IlBoolean fIsTimeSet
 
IlInt fStamp [FIELD_COUNT]
 Pseudo-time-stamps that specify when each field was set. More...
 

Detailed Description

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

Member Enumeration Documentation

§ EEras

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.

Constructor & Destructor Documentation

§ IlGregorianCalendar() [1/9]

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.

Parameters
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.

§ IlGregorianCalendar() [2/9]

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.

Parameters
zoneToAdoptThe given time zone.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.

§ IlGregorianCalendar() [3/9]

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.

Parameters
zoneThe given time zone.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.

§ IlGregorianCalendar() [4/9]

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.

Parameters
aLocaleThe given locale.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.

§ IlGregorianCalendar() [5/9]

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.

Parameters
zoneToAdoptThe given time zone.
aLocaleThe given locale.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.

§ IlGregorianCalendar() [6/9]

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.

Parameters
zoneThe given time zone.
aLocaleThe given locale.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.

§ IlGregorianCalendar() [7/9]

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.

Parameters
yearThe value used to set the YEAR time field in the calendar.
monthThe value used to set the MONTH time field in the calendar. The month value is 0-based, for example, 0 for January.
dateThe value used to set the DATE time field in the calendar.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.
Note
This constructor does not check the date because the check can be dependent on the locale. To check the date, you must call the validateFields function. This function returns IlTrue if the date is valid.

§ IlGregorianCalendar() [8/9]

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.

Parameters
yearThe value used to set the YEAR time field in the calendar.
monthThe value used to set the MONTH time field in the calendar. The month value is 0-based, for example, 0 for January.
dateThe value used to set the DATE time field in the calendar.
hourThe value used to set the HOUR_OF_DAY time field in the calendar.
minuteThe value used to set the MINUTE time field in the calendar.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.
Note
This constructor does not check the date because the check can be dependent on the locale. To check the date, you must call the validateFields function. This function returns IlTrue if the date is valid.

§ IlGregorianCalendar() [9/9]

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.

Parameters
yearThe value used to set the YEAR time field in the calendar.
monthThe value used to set the MONTH time field in the calendar. The month value is 0-based, for example, 0 for January.
dateThe value used to set the DATE time field in the calendar.
hourThe value used to set the HOUR_OF_DAY time field in the calendar.
minuteThe value used to set the MINUTE time field in the calendar.
secondThe value used to set the SECOND time field in the calendar.
successIndicates the status of IlGregorianCalendar object construction. Returns IL_DATE_ZERO_ERROR if constructed successfully.
Note
This constructor does not check the date because the check can be dependent on the locale. To check the date, you must call the validateFields function. This function returns IlTrue if the date is valid.

Member Function Documentation

§ add()

virtual void IlGregorianCalendar::add ( IlDateFields  field,
IlInt  amount,
IlDateErrorCode status 
)
virtual

Adds the specified (signed) amount of time to the given time field, based on the calendar rules.

(Overrides IlCalendar) IlDate Arithmetic function.

Parameters
fieldThe time field.
amountThe amount of date or time to be added to the field.
statusThe 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.
See also
IlCalendar::add().

Implements IlCalendar.

§ computeFields()

virtual void IlGregorianCalendar::computeFields ( IlDateErrorCode status)
protectedvirtual

Converts GMT as milliseconds to time field values.

(Overrides IlCalendar)

Implements IlCalendar.

§ computeTime()

virtual void IlGregorianCalendar::computeTime ( IlDateErrorCode status)
protectedvirtual

Converts IlCalendar time field values to GMT as milliseconds.

(Overrides IlCalendar)

Parameters
statusThe 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.

§ equivalentTo()

virtual IlBoolean IlGregorianCalendar::equivalentTo ( const IlCalendar other) const
virtual

IlCalendar override.

Returns
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.

§ getActualMaximum()

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.

§ getActualMinimum()

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().

§ getGreatestMinimum()

virtual IlInt IlGregorianCalendar::getGreatestMinimum ( IlDateFields  field) const
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.

§ getGregorianChange()

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.

Returns
The Gregorian cutover time for this calendar.

§ getLeastMaximum()

virtual IlInt IlGregorianCalendar::getLeastMaximum ( IlDateFields  field) const
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.

§ getMaximum()

virtual IlInt IlGregorianCalendar::getMaximum ( IlDateFields  field) const
virtual

Returns the maximum value for the given field.

For example, for Gregorian DAY_OF_MONTH, 31. (Overrides IlCalendar).

Implements IlCalendar.

§ getMinimum()

virtual IlInt IlGregorianCalendar::getMinimum ( IlDateFields  field) const
virtual

Returns the minimum value for the given field.

For example, for Gregorian DAY_OF_MONTH, 1. (Overrides IlCalendar)

Implements IlCalendar.

§ inDaylightTime()

virtual IlBoolean IlGregorianCalendar::inDaylightTime ( IlDateErrorCode status) const
virtual

Returns IlTrue if the current date for this IlCalendar is in Daylight Savings Time.

Recognizes DST_OFFSET, if it is set. (Overrides IlCalendar)

Parameters
statusFill-in parameter which receives the status of this operation.
Returns
This parameter is set to IlTrue if the current date for this IlCalendar is in Daylight Savings Time. Otherwise, it is set to IlFalse.

Implements IlCalendar.

§ isLeapYear()

IlBoolean IlGregorianCalendar::isLeapYear ( IlInt  year) const

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).

Parameters
yearThe given year.
Returns
IlTrue if the given year is a leap year; IlFalse otherwise.

§ operator==()

virtual IlBoolean IlGregorianCalendar::operator== ( const IlCalendar that) const
virtual

Compares the equality of two IlGregorianCalendar objects.

Objects of different subclasses are considered unequal. This is a strict equality test.

See also
IlCalendar::operator==()
Parameters
thatThe IlGregorianCalendar object to be compared with.
Returns
IlTrue if the given IlGregorianCalendar is the same as this IlGregorianCalendar, otherwise IlFalse.

Reimplemented from IlCalendar.

§ roll()

virtual void IlGregorianCalendar::roll ( IlDateFields  field,
IlInt  amount,
IlDateErrorCode status 
)
virtual

Rolls up or down by the given amount in the specified field.

(Overrides IlCalendar)

Parameters
fieldThe time field.
amountIndicates amount to roll.
statusThe 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.
See also
IlCalendar::roll().

Implements IlCalendar.

§ setGregorianChange()

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.

Parameters
dateThe given Gregorian cutover date.
successOutput param set to success/failure code on exit.

© Copyright 2018, 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.