Go to the documentation of this file.
31 #if U_SHOW_CPLUSPLUS_API
33 #if !UCONFIG_NO_FORMATTING
355 #ifndef U_FORCE_HIDE_DEPRECATED_API
368 #endif // U_FORCE_HIDE_DEPRECATED_API
383 #ifndef U_HIDE_DEPRECATED_API
414 #ifndef U_HIDE_DEPRECATED_API
515 UBool useMonth)
const;
562 #ifndef U_HIDE_INTERNAL_API
666 static double computeJulianDayOfYear(
UBool isGregorian, int32_t year,
673 UBool validateFields(
void)
const;
689 int32_t aggregateStamp(int32_t stamp_a, int32_t stamp_b);
698 UDate fGregorianCutover;
703 int32_t fCutoverJulianDay;
710 UDate fNormalizedGregorianCutover;
716 int32_t fGregorianCutoverYear;
722 int32_t fGregorianCutoverJulianDay;
731 static double millisToJulianDay(
UDate millis);
740 static UDate julianDayToMillis(
double julian);
753 UBool fInvertGregorian;
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.
GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, UErrorCode &success)
Constructs a GregorianCalendar with the given AD date and time set for the default time zone with the...
virtual UDate defaultCenturyStart() const
virtual GregorianCalendar * clone() const
Create and return a polymorphic copy of this calendar.
GregorianCalendar(const Locale &aLocale, UErrorCode &success)
Constructs a GregorianCalendar based on the current time in the default time zone with the given loca...
virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const
Subclass API for defining limits of different types.
Basic definitions for ICU, for both C and C++ APIs.
virtual UClassID getDynamicClassID(void) const
Override Calendar Returns a unique class ID POLYMORPHICALLY.
GregorianCalendar(const TimeZone &zone, const Locale &aLocale, UErrorCode &success)
Constructs a GregorianCalendar based on the current time in the given time zone with the given locale...
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
int8_t UBool
The ICU boolean type, a signed-byte integer.
virtual ~GregorianCalendar()
Destructor.
virtual int32_t monthLength(int32_t month) const
return the length of the given month.
GregorianCalendar(UErrorCode &success)
Constructs a default GregorianCalendar using the current time in the default time zone with the defau...
TimeZone represents a time zone offset, and also figures out daylight savings.
virtual UDate getEpochDay(UErrorCode &status)
Return the day number with respect to the epoch.
virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy)
Subclasses may override this to convert from week fields (YEAR_WOY and WEEK_OF_YEAR) to an extended y...
virtual int32_t defaultCenturyStartYear() const
GregorianCalendar(const GregorianCalendar &source)
Copy constructor.
virtual UBool inDaylightTime(UErrorCode &status) const
(Overrides Calendar) Return true if the current date for this Calendar is in Daylight Savings Time.
virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField)
Subclasses may override this.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
virtual UBool isEquivalentTo(const Calendar &other) const
Returns true if the given Calendar object is equivalent to this one.
int32_t getActualMinimum(UCalendarDateFields field, UErrorCode &status) const
Return the minimum value that this field could have, given the current date.
virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode &status)
(Overrides Calendar) Rolls up or down by the given amount in the specified field.
UDate getGregorianChange(void) const
Gets the Gregorian Calendar change date.
UBool isLeapYear(int32_t year) const
Return true if the given year is a leap year.
virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const
Return the Julian day number of day before the first day of the given month in the given extended yea...
GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode &success)
Constructs a GregorianCalendar with the given AD date and time set for the default time zone with the...
int32_t yearLength(void) const
return the length of the year field.
void pinDayOfMonth(void)
After adjustments such as add(MONTH), add(YEAR), we don't want the month to jump around.
Concrete class which provides the standard calendar used by most of the world.
C++ API: Calendar object.
virtual int32_t internalGetEra() const
Return the ERA.
EEras
Useful constants for GregorianCalendar and TimeZone.
int32_t getActualMinimum(EDateFields field) const
Return the minimum 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.
GregorianCalendar(const TimeZone &zone, UErrorCode &success)
Constructs a GregorianCalendar based on the current time in the given time zone with the default loca...
int32_t getActualMinimum(EDateFields field, UErrorCode &status) const
Return the minimum value that this field could have, given the current date.
GregorianCalendar(int32_t year, int32_t month, int32_t date, UErrorCode &success)
Constructs a GregorianCalendar with the given AD date set in the default time zone with the default l...
double UDate
Date and Time data type.
GregorianCalendar & operator=(const GregorianCalendar &right)
Default assignment operator.
int32_t getActualMaximum(EDateFields field) const
Return the maximum value that this field could have, given the current date.
void setGregorianChange(UDate date, UErrorCode &success)
Sets the GregorianCalendar change date.
virtual int32_t handleGetExtendedYear()
Return the extended year defined by the current fields.
virtual UBool haveDefaultCentury() const
UCalendarDateFields
Possible fields in a UCalendar.
GregorianCalendar(TimeZone *zoneToAdopt, UErrorCode &success)
Constructs a GregorianCalendar based on the current time in the given time zone with the default loca...
virtual const char * getType() const
Returns the calendar type name string for this Calendar object.
int32_t yearLength(int32_t year) const
return the length of the given year.
virtual int32_t handleGetYearLength(int32_t eyear) const
Return the number of days in the given extended year of this calendar system.
EDateFields
Field IDs for date and time.
virtual int32_t monthLength(int32_t month, int32_t year) const
return the length of the month according to the given year.
A Locale object represents a specific geographical, political, or cultural region.
virtual void handleComputeFields(int32_t julianDay, UErrorCode &status)
Subclasses may override this method to compute several fields specific to each calendar system.
virtual void roll(EDateFields field, int32_t amount, UErrorCode &status)
(Overrides Calendar) Rolls up or down by the given amount in the specified field.
GregorianCalendar(TimeZone *zoneToAdopt, const Locale &aLocale, UErrorCode &success)
Constructs a GregorianCalendar based on the current time in the given time zone with the given locale...
static UClassID getStaticClassID(void)
Return the class ID for this class.