Calendar is an abstract base class for converting between a UDate object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on.
More...
#include <calendar.h>

Public Types | |
| enum | EDateFields { 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, YEAR_WOY, DOW_LOCAL, EXTENDED_YEAR, JULIAN_DAY, MILLISECONDS_IN_DAY, IS_LEAP_MONTH, FIELD_COUNT = UCAL_FIELD_COUNT } |
| Field IDs for date and time. More... | |
| enum | EDaysOfWeek { SUNDAY = 1, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } |
| Useful constant for days of week. More... | |
| enum | EMonths { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER, UNDECIMBER } |
| Useful constants for month. More... | |
| enum | EAmpm { AM, PM } |
| Useful constants for hour in 12-hour clock. More... | |
Public Member Functions | |
| virtual | ~Calendar () |
| destructor | |
| virtual Calendar * | clone (void) const =0 |
| Create and return a polymorphic copy of this calendar. | |
| UDate | getTime (UErrorCode &status) const |
| Gets this Calendar's time as milliseconds. | |
| void | setTime (UDate date, UErrorCode &status) |
| Sets this Calendar's current time with the given UDate. | |
| virtual UBool | operator== (const Calendar &that) const |
| Compares the equality of two Calendar objects. | |
| UBool | operator!= (const Calendar &that) const |
| Compares the inequality of two Calendar objects. | |
| virtual UBool | isEquivalentTo (const Calendar &other) const |
| Returns TRUE if the given Calendar object is equivalent to this one. | |
| UBool | equals (const Calendar &when, UErrorCode &status) const |
| Compares the Calendar time, whereas Calendar::operator== compares the equality of Calendar objects. | |
| UBool | before (const Calendar &when, UErrorCode &status) const |
| Returns true if this Calendar's current time is before "when"'s current time. | |
| UBool | after (const Calendar &when, UErrorCode &status) const |
| Returns true if this Calendar's current time is after "when"'s current time. | |
| virtual void | add (EDateFields field, int32_t amount, UErrorCode &status) |
| UDate Arithmetic function. | |
| virtual void | add (UCalendarDateFields field, int32_t amount, UErrorCode &status) |
| UDate Arithmetic function. | |
| void | roll (EDateFields field, UBool up, UErrorCode &status) |
| Time Field Rolling function. | |
| void | roll (UCalendarDateFields field, UBool up, UErrorCode &status) |
| Time Field Rolling function. | |
| virtual void | roll (EDateFields field, int32_t amount, UErrorCode &status) |
| Time Field Rolling function. | |
| virtual void | roll (UCalendarDateFields field, int32_t amount, UErrorCode &status) |
| Time Field Rolling function. | |
| virtual int32_t | fieldDifference (UDate when, EDateFields field, UErrorCode &status) |
| Return the difference between the given time and the time this calendar object is set to. | |
| virtual int32_t | fieldDifference (UDate when, UCalendarDateFields field, UErrorCode &status) |
| Return the difference between the given time and the time this calendar object is set to. | |
| void | adoptTimeZone (TimeZone *value) |
| Sets the calendar's time zone to be the one passed in. | |
| void | setTimeZone (const TimeZone &zone) |
| Sets the calendar's time zone to be the same as the one passed in. | |
| const TimeZone & | getTimeZone (void) const |
| Returns a reference to the time zone owned by this calendar. | |
| TimeZone * | orphanTimeZone (void) |
| Returns the time zone owned by this calendar. | |
| virtual UBool | inDaylightTime (UErrorCode &status) const =0 |
| Queries if the current date for this Calendar is in Daylight Savings Time. | |
| void | setLenient (UBool lenient) |
| Specifies whether or not date/time interpretation is to be lenient. | |
| UBool | isLenient (void) const |
| Tells whether date/time interpretation is to be lenient. | |
| void | setFirstDayOfWeek (EDaysOfWeek value) |
| Sets what the first day of the week is; e.g., Sunday in US, Monday in France. | |
| void | setFirstDayOfWeek (UCalendarDaysOfWeek value) |
| Sets what the first day of the week is; e.g., Sunday in US, Monday in France. | |
| EDaysOfWeek | getFirstDayOfWeek (void) const |
| Gets what the first day of the week is; e.g., Sunday in US, Monday in France. | |
| UCalendarDaysOfWeek | getFirstDayOfWeek (UErrorCode &status) const |
| Gets what the first day of the week is; e.g., Sunday in US, Monday in France. | |
| void | setMinimalDaysInFirstWeek (uint8_t value) |
| Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call the method with value 1. | |
| uint8_t | getMinimalDaysInFirstWeek (void) const |
| Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, getMinimalDaysInFirstWeek returns 1. | |
| virtual int32_t | getMinimum (EDateFields field) const |
| Gets the minimum value for the given time field. | |
| virtual int32_t | getMinimum (UCalendarDateFields field) const |
| Gets the minimum value for the given time field. | |
| virtual int32_t | getMaximum (EDateFields field) const |
| Gets the maximum value for the given time field. | |
| virtual int32_t | getMaximum (UCalendarDateFields field) const |
| Gets the maximum value for the given time field. | |
| virtual int32_t | getGreatestMinimum (EDateFields field) const |
| Gets the highest minimum value for the given field if varies. | |
| virtual int32_t | getGreatestMinimum (UCalendarDateFields field) const |
| Gets the highest minimum value for the given field if varies. | |
| virtual int32_t | getLeastMaximum (EDateFields field) const |
| Gets the lowest maximum value for the given field if varies. | |
| virtual int32_t | getLeastMaximum (UCalendarDateFields field) const |
| Gets the lowest maximum value for the given field if varies. | |
| int32_t | getActualMinimum (EDateFields field, UErrorCode &status) const |
| Return the minimum value that this field could have, given the current date. | |
| virtual int32_t | getActualMinimum (UCalendarDateFields field, UErrorCode &status) const |
| Return the minimum value that this field could have, given the current date. | |
| int32_t | getActualMaximum (EDateFields field, UErrorCode &status) const |
| Return the maximum value that this field could have, given the current date. | |
| virtual int32_t | getActualMaximum (UCalendarDateFields field, UErrorCode &status) const |
| Return the maximum value that this field could have, given the current date. | |
| int32_t | get (EDateFields field, UErrorCode &status) const |
| Gets the value for a given time field. | |
| int32_t | get (UCalendarDateFields field, UErrorCode &status) const |
| Gets the value for a given time field. | |
| UBool | isSet (EDateFields field) const |
| Determines if the given time field has a value set. | |
| UBool | isSet (UCalendarDateFields field) const |
| Determines if the given time field has a value set. | |
| void | set (EDateFields field, int32_t value) |
| Sets the given time field with the given value. | |
| void | set (UCalendarDateFields field, int32_t value) |
| Sets the given time field with the given value. | |
| void | set (int32_t year, int32_t month, int32_t date) |
| Sets the values for the fields YEAR, MONTH, and DATE. | |
| void | set (int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute) |
| Sets the values for the fields YEAR, MONTH, DATE, HOUR_OF_DAY, and MINUTE. | |
| void | set (int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second) |
| Sets the values for the fields YEAR, MONTH, DATE, HOUR_OF_DAY, MINUTE, and SECOND. | |
| void | clear (void) |
| Clears the values of all the time fields, making them both unset and assigning them a value of zero. | |
| void | clear (EDateFields field) |
| Clears the value in the given time field, both making it unset and assigning it a value of zero. | |
| void | clear (UCalendarDateFields field) |
| Clears the value in the given time field, both making it unset and assigning it a value of zero. | |
| virtual UClassID | getDynamicClassID (void) const =0 |
| Returns a unique class ID POLYMORPHICALLY. | |
| virtual const char * | getType () const =0 |
| Returns the resource key string used for this calendar type. | |
| virtual UBool | haveDefaultCentury () const =0 |
| virtual UDate | defaultCenturyStart () const =0 |
| virtual int32_t | defaultCenturyStartYear () const =0 |
| Locale | getLocale (ULocDataLocaleType type, UErrorCode &status) const |
| Get the locale for this calendar object. | |
| const char * | getLocaleID (ULocDataLocaleType type, UErrorCode &status) const |
| Get the locale for this calendar object. | |
Static Public Member Functions | |
| static Calendar * | createInstance (UErrorCode &success) |
| Creates a Calendar using the default timezone and locale. | |
| static Calendar * | createInstance (TimeZone *zoneToAdopt, UErrorCode &success) |
| Creates a Calendar using the given timezone and the default locale. | |
| static Calendar * | createInstance (const TimeZone &zone, UErrorCode &success) |
| Creates a Calendar using the given timezone and the default locale. | |
| static Calendar * | createInstance (const Locale &aLocale, UErrorCode &success) |
| Creates a Calendar using the default timezone and the given locale. | |
| static Calendar * | createInstance (TimeZone *zoneToAdopt, const Locale &aLocale, UErrorCode &success) |
| Creates a Calendar using the given timezone and given locale. | |
| static Calendar * | createInstance (const TimeZone &zoneToAdopt, const Locale &aLocale, UErrorCode &success) |
| Gets a Calendar using the given timezone and given locale. | |
| static const Locale * | getAvailableLocales (int32_t &count) |
| Returns a list of the locales for which Calendars are installed. | |
| static UDate | getNow (void) |
| Returns the current UTC (GMT) time measured in milliseconds since 0:00:00 on 1/1/70 (derived from the system time). | |
| static StringEnumeration * | getAvailableLocales (void) |
| INTERNAL FOR 2.6 -- Registration. | |
| static URegistryKey | registerFactory (ICUServiceFactory *toAdopt, UErrorCode &status) |
| Register a new Calendar factory. | |
| static UBool | unregister (URegistryKey key, UErrorCode &status) |
| Unregister a previously-registered CalendarFactory using the key returned from the register call. | |
Protected Types | |
| enum | ELimitType { UCAL_LIMIT_MINIMUM = 0, UCAL_LIMIT_GREATEST_MINIMUM, UCAL_LIMIT_LEAST_MAXIMUM, UCAL_LIMIT_MAXIMUM, UCAL_LIMIT_COUNT } |
| Limit enums. More... | |
| enum | { kResolveSTOP = -1, kResolveRemap = 32 } |
| Values for field resolution tables. More... | |
| enum | { kUnset = 0, kInternallySet, kMinimumUserStamp } |
| Special values of stamp[]. More... | |
Protected Member Functions | |
| Calendar (UErrorCode &success) | |
| Constructs a Calendar with the default time zone as returned by TimeZone::createInstance(), and the default locale. | |
| Calendar (const Calendar &source) | |
| Copy constructor. | |
| Calendar & | operator= (const Calendar &right) |
| Default assignment operator. | |
| Calendar (TimeZone *zone, const Locale &aLocale, UErrorCode &success) | |
| Constructs a Calendar with the given time zone and locale. | |
| Calendar (const TimeZone &zone, const Locale &aLocale, UErrorCode &success) | |
| Constructs a Calendar with the given time zone and locale. | |
| virtual void | computeTime (UErrorCode &status) |
| Converts Calendar's time field values to GMT as milliseconds. | |
| virtual void | computeFields (UErrorCode &status) |
| Converts GMT as milliseconds to time field values. | |
| double | getTimeInMillis (UErrorCode &status) const |
| Gets this Calendar's current time as a long. | |
| void | setTimeInMillis (double millis, UErrorCode &status) |
| Sets this Calendar's current time from the given long value. | |
| void | complete (UErrorCode &status) |
| Recomputes the current time from currently set fields, and then fills in any unset fields in the time field list. | |
| int32_t | internalGet (EDateFields field) const |
| Gets the value for a given time field. | |
| int32_t | internalGet (UCalendarDateFields field, int32_t defaultValue) const |
| Gets the value for a given time field. | |
| int32_t | internalGet (UCalendarDateFields field) const |
| Gets the value for a given time field. | |
| void | internalSet (EDateFields field, int32_t value) |
| Sets the value for a given time field. | |
| void | internalSet (UCalendarDateFields field, int32_t value) |
| Sets the value for a given time field. | |
| virtual void | prepareGetActual (UCalendarDateFields field, UBool isMinimum, UErrorCode &status) |
| Prepare this calendar for computing the actual minimum or maximum. | |
| virtual int32_t | handleGetLimit (UCalendarDateFields field, ELimitType limitType) const =0 |
| Subclass API for defining limits of different types. | |
| virtual int32_t | getLimit (UCalendarDateFields field, ELimitType limitType) const |
| Return a limit for a field. | |
| virtual int32_t | handleComputeMonthStart (int32_t eyear, int32_t month, UBool useMonth) const =0 |
| Return the Julian day number of day before the first day of the given month in the given extended year. | |
| virtual int32_t | handleGetMonthLength (int32_t extendedYear, int32_t month) const |
| Return the number of days in the given month of the given extended year of this calendar system. | |
| virtual int32_t | handleGetYearLength (int32_t eyear) const |
| Return the number of days in the given extended year of this calendar system. | |
| virtual int32_t | handleGetExtendedYear ()=0 |
| Return the extended year defined by the current fields. | |
| virtual int32_t | handleComputeJulianDay (UCalendarDateFields bestField) |
| Subclasses may override this. | |
| virtual int32_t | handleGetExtendedYearFromWeekFields (int32_t yearWoy, int32_t woy) |
| Subclasses must override this to convert from week fields (YEAR_WOY and WEEK_OF_YEAR) to an extended year in the case where YEAR, EXTENDED_YEAR are not set. | |
| int32_t | computeJulianDay () |
| Compute the Julian day from fields. | |
| int32_t | computeMillisInDay () |
| Compute the milliseconds in the day from the fields. | |
| int32_t | computeZoneOffset (double millis, int32_t millisInDay, UErrorCode &ec) |
| This method can assume EXTENDED_YEAR has been set. | |
| int32_t | newestStamp (UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const |
| Determine the best stamp in a range. | |
| UCalendarDateFields | resolveFields (const UFieldResolutionTable *precedenceTable) |
| Given a precedence table, return the newest field combination in the table, or UCAL_FIELD_COUNT if none is found. | |
| virtual const UFieldResolutionTable * | getFieldResolutionTable () const |
| UCalendarDateFields | newerField (UCalendarDateFields defaultField, UCalendarDateFields alternateField) const |
| Return the field that is newer, either defaultField, or alternateField. | |
| UDate | internalGetTime (void) const |
| Get the current time without recomputing. | |
| void | internalSetTime (UDate time) |
| Set the current time without affecting flags or fields. | |
| virtual void | handleComputeFields (int32_t julianDay, UErrorCode &status) |
| Subclasses may override this method to compute several fields specific to each calendar system. | |
| int32_t | getGregorianYear () const |
Return the extended year on the Gregorian calendar as computed by computeGregorianFields(). | |
| int32_t | getGregorianMonth () const |
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields(). | |
| int32_t | getGregorianDayOfYear () const |
Return the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields(). | |
| int32_t | getGregorianDayOfMonth () const |
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields(). | |
| virtual int32_t | getDefaultMonthInYear () |
| Called by computeJulianDay. | |
| virtual int32_t | getDefaultDayInMonth (int32_t) |
| Called by computeJulianDay. | |
| virtual void | pinField (UCalendarDateFields field, UErrorCode &status) |
| Adjust the specified field so that it is within the allowable range for the date to which this calendar is set. | |
| int32_t | weekNumber (int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek) |
| Return the week number of a day, within a period. | |
| int32_t | weekNumber (int32_t dayOfPeriod, int32_t dayOfWeek) |
| Return the week number of a day, within a period. | |
| int32_t | getLocalDOW () |
| returns the local DOW, valid range 0. | |
| void | computeGregorianFields (int32_t julianDay, UErrorCode &ec) |
| Compute the Gregorian calendar year, month, and day of month from the Julian day. | |
Static Protected Member Functions | |
| static uint8_t | julianDayToDayOfWeek (double julian) |
| Convert a quasi Julian date to the day of the week. | |
Protected Attributes | |
| UBool | fIsTimeSet |
| The flag which indicates if the current time is set in the calendar. | |
| UBool | fAreFieldsSet |
| True if the fields are in sync with the currently set time of this Calendar. | |
| UBool | fAreAllFieldsSet |
| True if all of the fields have been set. | |
| UBool | fAreFieldsVirtuallySet |
| True if all fields have been virtually set, but have not yet been computed. | |
| int32_t | fFields [UCAL_FIELD_COUNT] |
| The time fields containing values into which the millis is computed. | |
| UBool | fIsSet [UCAL_FIELD_COUNT] |
| The flags which tell if a specified time field for the calendar is set. | |
| int32_t | fStamp [UCAL_FIELD_COUNT] |
| Pseudo-time-stamps which specify when each field was set. | |
Static Protected Attributes | |
| static const UFieldResolutionTable | kDatePrecedence [] |
| Precedence table for Dates. | |
| static const UFieldResolutionTable | kYearPrecedence [] |
| Precedence table for Year. | |
| static const UFieldResolutionTable | kDOWPrecedence [] |
| Precedence table for Day of Week. | |
Friends | |
| class | CalendarFactory |
| Multiple Calendar Implementation. | |
| class | CalendarService |
| Multiple Calendar Implementation. | |
| class | DefaultCalendarFactory |
| Multiple Calendar Implementation. | |
Calendar is an abstract base class for converting between a UDate object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on.
(A UDate object represents a specific instant in time with millisecond precision. See UDate for information about the UDate class.)
Subclasses of Calendar interpret a UDate according to the rules of a specific calendar system. The most commonly used subclass of Calendar is GregorianCalendar. Other subclasses could represent the various types of lunar calendars in use in many parts of the world.
NOTE: (ICU 2.6) The subclass interface should be considered unstable
Like other locale-sensitive classes, Calendar provides a static method, createInstance, for getting a generally useful object of this type. Calendar's createInstance method returns the appropriate Calendar subclass whose time fields have been initialized with the current date and time:
Calendar *rightNow = Calendar::createInstance(errCode);
A Calendar object can produce all the time field values needed to implement the date-time formatting for a particular language and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
When computing a UDate from time fields, two special circumstances may arise: there may be insufficient information to compute the UDate (such as only year and month but no day in the month), or there may be inconsistent information (such as "Tuesday, July 15, 1996" -- July 15, 1996 is actually a Monday).
Insufficient information. The calendar will use default information to specify the missing fields. This may vary by calendar; for the Gregorian calendar, the default for a field is the same as that of the start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc.
Inconsistent information. If fields conflict, the calendar will give preference to fields set more recently. For example, when determining the day, the calendar will look for one of the following combinations of fields. The most recent combination, as determined by the most recently set single field, will be used.
MONTH + DAY_OF_MONTH MONTH + WEEK_OF_MONTH + DAY_OF_WEEK MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK DAY_OF_YEAR DAY_OF_WEEK + WEEK_OF_YEAR
For the time of day:
HOUR_OF_DAY AM_PM + HOUR
Note: for some non-Gregorian calendars, different fields may be necessary for complete disambiguation. For example, a full specification of the historial Arabic astronomical calendar requires year, month, day-of-month and day-of-week in some cases.
Note: There are certain possible ambiguities in interpretation of certain singular times, which are resolved in the following ways:
The date or time format strings are not part of the definition of a calendar, as those must be modifiable or overridable by the user at runtime. Use DateFormat to format dates.
Calendar provides an API for field "rolling", where fields can be incremented or decremented, but wrap around. For example, rolling the month up in the date December 12, 1996 results in January 12, 1996.
Calendar also provides a date arithmetic function for adding the specified (signed) amount of time to a particular time field. For example, subtracting 5 days from the date September 12, 1996 results in September 7, 1996.
Definition at line 165 of file calendar.h.
Field IDs for date and time.
Used to specify date/time fields. ERA is calendar specific. Example ranges given are for illustration only; see specific Calendar subclasses for actual ranges.
Definition at line 174 of file calendar.h.
Useful constant for days of week.
Note: Calendar day-of-week is 1-based. Clients who create locale resources for the field of first-day-of-week should be aware of this. For instance, in US locale, first-day-of-week is set to 1, i.e., SUNDAY.
Definition at line 211 of file calendar.h.
| enum Calendar::EMonths |
Useful constants for month.
Note: Calendar month is 0-based.
Definition at line 227 of file calendar.h.
| enum Calendar::EAmpm |
Useful constants for hour in 12-hour clock.
Used in GregorianCalendar.
Definition at line 249 of file calendar.h.
enum Calendar::ELimitType [protected] |
Limit enums.
Not in sync with UCalendarLimitType (refers to internal fields).
Definition at line 1339 of file calendar.h.
anonymous enum [protected] |
Values for field resolution tables.
Definition at line 1489 of file calendar.h.
anonymous enum [protected] |
| virtual Calendar::~Calendar | ( | ) | [virtual] |
| Calendar::Calendar | ( | UErrorCode & | success | ) | [protected] |
| Calendar::Calendar | ( | const Calendar & | source | ) | [protected] |
| Calendar::Calendar | ( | TimeZone * | zone, | |
| const Locale & | aLocale, | |||
| UErrorCode & | success | |||
| ) | [protected] |
Constructs a Calendar with the given time zone and locale.
Clients are no longer responsible for deleting the given time zone object after it's adopted.
| zone | The given time zone. | |
| aLocale | The given locale. | |
| success | Indicates the status of Calendar object construction. Returns U_ZERO_ERROR if constructed successfully. |
| Calendar::Calendar | ( | const TimeZone & | zone, | |
| const Locale & | aLocale, | |||
| UErrorCode & | success | |||
| ) | [protected] |
| virtual Calendar* Calendar::clone | ( | void | ) | const [pure virtual] |
Create and return a polymorphic copy of this calendar.
Implemented in GregorianCalendar.
| static Calendar* Calendar::createInstance | ( | UErrorCode & | success | ) | [static] |
Creates a Calendar using the default timezone and locale.
Clients are responsible for deleting the object returned.
| success | Indicates the success/failure of Calendar creation. Filled in with U_ZERO_ERROR if created successfully, set to a failure result otherwise. U_MISSING_RESOURCE_ERROR will be returned if the resource data requests a calendar type which has not been installed. |
Referenced by createInstance().
| Calendar * Calendar::createInstance | ( | TimeZone * | zoneToAdopt, | |
| UErrorCode & | success | |||
| ) | [inline, static] |
Creates a Calendar using the given timezone and the default locale.
The Calendar takes ownership of zoneToAdopt; the client must not delete it.
| zoneToAdopt | The given timezone to be adopted. | |
| success | Indicates the success/failure of Calendar creation. Filled in with U_ZERO_ERROR if created successfully, set to a failure result otherwise. |
Definition at line 2124 of file calendar.h.
References createInstance(), and Locale::getDefault().
| static Calendar* Calendar::createInstance | ( | const TimeZone & | zone, | |
| UErrorCode & | success | |||
| ) | [static] |
Creates a Calendar using the given timezone and the default locale.
The TimeZone is _not_ adopted; the client is still responsible for deleting it.
| zone | The timezone. | |
| success | Indicates the success/failure of Calendar creation. Filled in with U_ZERO_ERROR if created successfully, set to a failure result otherwise. |
| static Calendar* Calendar::createInstance | ( | const Locale & | aLocale, | |
| UErrorCode & | success | |||
| ) | [static] |
Creates a Calendar using the default timezone and the given locale.
| aLocale | The given locale. | |
| success | Indicates the success/failure of Calendar creation. Filled in with U_ZERO_ERROR if created successfully, set to a failure result otherwise. |
| static Calendar* Calendar::createInstance | ( | TimeZone * | zoneToAdopt, | |
| const Locale & | aLocale, | |||
| UErrorCode & | success | |||
| ) | [static] |
Creates a Calendar using the given timezone and given locale.
The Calendar takes ownership of zoneToAdopt; the client must not delete it.
| zoneToAdopt | The given timezone to be adopted. | |
| aLocale | The given locale. | |
| success | Indicates the success/failure of Calendar creation. Filled in with U_ZERO_ERROR if created successfully, set to a failure result otherwise. |
| static Calendar* Calendar::createInstance | ( | const TimeZone & | zoneToAdopt, | |
| const Locale & | aLocale, | |||
| UErrorCode & | success | |||
| ) | [static] |
Gets a Calendar using the given timezone and given locale.
The TimeZone is _not_ adopted; the client is still responsible for deleting it.
| zoneToAdopt | The given timezone to be adopted. | |
| aLocale | The given locale. | |
| success | Indicates the success/failure of Calendar creation. Filled in with U_ZERO_ERROR if created successfully, set to a failure result otherwise. |
| static const Locale* Calendar::getAvailableLocales | ( | int32_t & | count | ) | [static] |
Returns a list of the locales for which Calendars are installed.
| count | Number of locales returned. |
| static UDate Calendar::getNow | ( | void | ) | [static] |
Returns the current UTC (GMT) time measured in milliseconds since 0:00:00 on 1/1/70 (derived from the system time).
| UDate Calendar::getTime | ( | UErrorCode & | status | ) | const [inline] |
Gets this Calendar's time as milliseconds.
May involve recalculation of time due to previous calls to set time field values. The time specified is non-local UTC (GMT) time. Although this method is const, this object may actually be changed (semantically const).
| status | Output param set to success/failure code on exit. If any value previously set in the time field is invalid or restricted by leniency, this will be set to an error status. |
Definition at line 384 of file calendar.h.
| void Calendar::setTime | ( | UDate | date, | |
| UErrorCode & | status | |||
| ) | [inline] |
Sets this Calendar's current time with the given UDate.
The time specified should be in non-local UTC (GMT) time.
| date | The given UDate in UTC (GMT) time. | |
| status | Output param set to success/failure code on exit. If any value set in the time field is invalid or restricted by leniency, this will be set to an error status. |
Definition at line 396 of file calendar.h.
Compares the equality of two Calendar objects.
Objects of different subclasses are considered unequal. This comparison is very exacting; two Calendar objects must be in exactly the same state to be considered equal. To compare based on the represented time, use equals() instead.
| that | The Calendar object to be compared with. |
| virtual UBool Calenda |