Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ucal.h File Reference

C API: Calendar. More...

#include "unicode/utypes.h"
#include "unicode/uenum.h"
#include "unicode/uloc.h"

Go to the source code of this file.

Typedefs

typedef void * UCalendar
 A calendar.
typedef enum UCalendarType UCalendarType
 ICU 2.0
typedef enum UCalendarDateFields UCalendarDateFields
 ICU 2.0
typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek
 ICU 2.0
typedef enum UCalendarMonths UCalendarMonths
 ICU 2.0
typedef enum UCalendarAMPMs UCalendarAMPMs
 ICU 2.0
typedef enum UCalendarDisplayNameType UCalendarDisplayNameType
 ICU 2.0
typedef enum UCalendarAttribute UCalendarAttribute
 ICU 2.0
typedef enum UCalendarLimitType UCalendarLimitType
 ICU 2.0

Enumerations

enum  UCalendarType { UCAL_TRADITIONAL, UCAL_GREGORIAN }
 Possible types of UCalendars ICU 2.0. More...
enum  UCalendarDateFields {
  UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR,
  UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
  UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY,
  UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET,
  UCAL_DST_OFFSET, UCAL_YEAR_WOY, UCAL_DOW_LOCAL, UCAL_EXTENDED_YEAR,
  UCAL_JULIAN_DAY, UCAL_MILLISECONDS_IN_DAY, UCAL_FIELD_COUNT, UCAL_DAY_OF_MONTH = UCAL_DATE
}
 Possible fields in a UCalendar ICU 2.0. More...
enum  UCalendarDaysOfWeek {
  UCAL_SUNDAY = 1, UCAL_MONDAY, UCAL_TUESDAY, UCAL_WEDNESDAY,
  UCAL_THURSDAY, UCAL_FRIDAY, UCAL_SATURDAY
}
 Possible days of the week in a UCalendar ICU 2.0. More...
enum  UCalendarMonths {
  UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL,
  UCAL_MAY, UCAL_JUNE, UCAL_JULY, UCAL_AUGUST,
  UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER,
  UCAL_UNDECIMBER
}
 Possible months in a UCalendar. More...
enum  UCalendarAMPMs { UCAL_AM, UCAL_PM }
 Possible AM/PM values in a UCalendar ICU 2.0. More...
enum  UCalendarDisplayNameType { UCAL_STANDARD, UCAL_SHORT_STANDARD, UCAL_DST, UCAL_SHORT_DST }
 Possible formats for a UCalendar's display name ICU 2.0. More...
enum  UCalendarAttribute { UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, UCAL_MINIMAL_DAYS_IN_FIRST_WEEK }
 Types of UCalendar attributes ICU 2.0. More...
enum  UCalendarLimitType {
  UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM, UCAL_LEAST_MAXIMUM,
  UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM
}
 Possible limit values for a UCalendar ICU 2.0. More...

Functions

U_CAPI UEnumeration *U_EXPORT2 ucal_openTimeZones (UErrorCode *ec)
 Create an enumeration over all time zones.
U_CAPI UEnumeration *U_EXPORT2 ucal_openCountryTimeZones (const char *country, UErrorCode *ec)
 Create an enumeration over all time zones associated with the given country.
U_CAPI int32_t U_EXPORT2 ucal_getDefaultTimeZone (UChar *result, int32_t resultCapacity, UErrorCode *ec)
 Return the default time zone.
U_CAPI void U_EXPORT2 ucal_setDefaultTimeZone (const UChar *zoneID, UErrorCode *ec)
 Set the default time zone.
U_CAPI int32_t U_EXPORT2 ucal_getDSTSavings (const UChar *zoneID, UErrorCode *ec)
 Return the amount of time in milliseconds that the clock is advanced during daylight savings time for the given time zone, or zero if the time zone does not observe daylight savings time.
U_CAPI UDate U_EXPORT2 ucal_getNow (void)
 Get the current date and time.
U_CAPI UCalendar *U_EXPORT2 ucal_open (const UChar *zoneID, int32_t len, const char *locale, UCalendarType type, UErrorCode *status)
 Open a UCalendar.
U_CAPI void U_EXPORT2 ucal_close (UCalendar *cal)
 Close a UCalendar.
U_CAPI void U_EXPORT2 ucal_setTimeZone (UCalendar *cal, const UChar *zoneID, int32_t len, UErrorCode *status)
 Set the TimeZone used by a UCalendar.
U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneDisplayName (const UCalendar *cal, UCalendarDisplayNameType type, const char *locale, UChar *result, int32_t resultLength, UErrorCode *status)
 Get the display name for a UCalendar's TimeZone.
U_CAPI UBool U_EXPORT2 ucal_inDaylightTime (const UCalendar *cal, UErrorCode *status)
 Determine if a UCalendar is currently in daylight savings time.
U_CAPI int32_t U_EXPORT2 ucal_getAttribute (const UCalendar *cal, UCalendarAttribute attr)
 Get a numeric attribute associated with a UCalendar.
U_CAPI void U_EXPORT2 ucal_setAttribute (UCalendar *cal, UCalendarAttribute attr, int32_t newValue)
 Set a numeric attribute associated with a UCalendar.
U_CAPI const char *U_EXPORT2 ucal_getAvailable (int32_t index)
 Get a locale for which calendars are available.
U_CAPI int32_t U_EXPORT2 ucal_countAvailable (void)
 Determine how many locales have calendars available.
U_CAPI UDate U_EXPORT2 ucal_getMillis (const UCalendar *cal, UErrorCode *status)
 Get a UCalendar's current time in millis.
U_CAPI void U_EXPORT2 ucal_setMillis (UCalendar *cal, UDate dateTime, UErrorCode *status)
 Set a UCalendar's current time in millis.
U_CAPI void U_EXPORT2 ucal_setDate (UCalendar *cal, int32_t year, int32_t month, int32_t date, UErrorCode *status)
 Set a UCalendar's current date.
U_CAPI void U_EXPORT2 ucal_setDateTime (UCalendar *cal, int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode *status)
 Set a UCalendar's current date.
U_CAPI UBool U_EXPORT2 ucal_equivalentTo (const UCalendar *cal1, const UCalendar *cal2)
 Returns TRUE if two UCalendars are equivalent.
U_CAPI void U_EXPORT2 ucal_add (UCalendar *cal, UCalendarDateFields field, int32_t amount, UErrorCode *status)
 Add a specified signed amount to a particular field in a UCalendar.
U_CAPI void U_EXPORT2 ucal_roll (UCalendar *cal, UCalendarDateFields field, int32_t amount, UErrorCode *status)
 Add a specified signed amount to a particular field in a UCalendar.
U_CAPI int32_t U_EXPORT2 ucal_get (const UCalendar *cal, UCalendarDateFields field, UErrorCode *status)
 Get the current value of a field from a UCalendar.
U_CAPI void U_EXPORT2 ucal_set (UCalendar *cal, UCalendarDateFields field, int32_t value)
 Set the value of a field in a UCalendar.
U_CAPI UBool U_EXPORT2 ucal_isSet (const UCalendar *cal, UCalendarDateFields field)
 Determine if a field in a UCalendar is set.
U_CAPI void U_EXPORT2 ucal_clearField (UCalendar *cal, UCalendarDateFields field)
 Clear a field in a UCalendar.
U_CAPI void U_EXPORT2 ucal_clear (UCalendar *calendar)
 Clear all fields in a UCalendar.
U_CAPI int32_t U_EXPORT2 ucal_getLimit (const UCalendar *cal, UCalendarDateFields field, UCalendarLimitType type, UErrorCode *status)
 Determine a limit for a field in a UCalendar.
U_CAPI const char *U_EXPORT2 ucal_getLocaleByType (const UCalendar *cal, ULocDataLocaleType type, UErrorCode *status)
 Get the locale for this calendar object.


Detailed Description

C API: Calendar.

Calendar C API

UCalendar C API is used for converting between a UDate object and a set of integer fields such as UCAL_YEAR, UCAL_MONTH, UCAL_DAY, UCAL_HOUR, and so on. (A UDate object represents a specific instant in time with millisecond precision. See UDate for information about the UDate .)

Types of UCalendar interpret a UDate according to the rules of a specific calendar system. The U_CAPI provides the enum UCalendarType with UCAL_TRADITIONAL and UCAL_GREGORIAN.

Like other locale-sensitive C API, calendar API provides a function, ucal_open(), which returns a pointer to UCalendar whose time fields have been initialized with the current date and time. We need to specify the type of calendar to be opened and the timezoneId. <blockquote>

 
 UCalendar *caldef;
 UChar *tzId;
 UErrorCode status;
 tzId=(UChar*)malloc(sizeof(UChar) * (strlen("PST") +1) );
 u_uastrcpy(tzId, "PST");
 caldef=ucal_open(tzID, u_strlen(tzID), NULL, UCAL_TRADITIONAL, &status);
</blockquote>

A UCalendar 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., UCAL_YEAR = 1970, UCAL_MONTH = JANUARY, UCAL_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.

<blockquote>

 
 UCAL_MONTH + UCAL_DAY_OF_MONTH
 UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK
 UCAL_MONTH + UCAL_DAY_OF_WEEK_IN_MONTH + UCAL_DAY_OF_WEEK
 UCAL_DAY_OF_YEAR
 UCAL_DAY_OF_WEEK + UCAL_WEEK_OF_YEAR
</blockquote>

For the time of day:

<blockquote>

 
 UCAL_HOUR_OF_DAY
 UCAL_AM_PM + UCAL_HOUR
</blockquote>

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:

  1. 24:00:00 "belongs" to the following day. That is, 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970

  2. Although historically not precise, midnight also belongs to "am", and noon belongs to "pm", so on the same day, 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm

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.

ICU 2.0


Typedef Documentation

typedef void* UCalendar
 

A calendar.

For usage in C programs. ICU 2.0


Enumeration Type Documentation

enum UCalendarAMPMs
 

Possible AM/PM values in a UCalendar ICU 2.0.

Enumeration values:
UCAL_AM  AM.
UCAL_PM  PM.

enum UCalendarAttribute
 

Types of UCalendar attributes ICU 2.0.

Enumeration values:
UCAL_LENIENT  Lenient parsing.
UCAL_FIRST_DAY_OF_WEEK  First day of week.
UCAL_MINIMAL_DAYS_IN_FIRST_WEEK  Minimum number of days in first week.

enum UCalendarDateFields
 

Possible fields in a UCalendar ICU 2.0.

Enumeration values:
UCAL_ERA  Era field ICU 2.6.
UCAL_YEAR  Year field ICU 2.6.
UCAL_MONTH  Month field ICU 2.6.
UCAL_WEEK_OF_YEAR  Week of year field ICU 2.6.
UCAL_WEEK_OF_MONTH  Week of month field ICU 2.6.
UCAL_DATE  Date field ICU 2.6.
UCAL_DAY_OF_YEAR  Day of year field ICU 2.6.
UCAL_DAY_OF_WEEK  Day of week field ICU 2.6.
UCAL_DAY_OF_WEEK_IN_MONTH  Day of week in month field ICU 2.6.
UCAL_AM_PM  AM/PM field ICU 2.6.
UCAL_HOUR  Hour field ICU 2.6.
UCAL_HOUR_OF_DAY  Hour of day field ICU 2.6.
UCAL_MINUTE  Minute field ICU 2.6.
UCAL_SECOND  Second field ICU 2.6.
UCAL_MILLISECOND  Millisecond field ICU 2.6.
UCAL_ZONE_OFFSET  Zone offset field ICU 2.6.
UCAL_DST_OFFSET  DST offset field ICU 2.6.
UCAL_YEAR_WOY  Year / week of year ICU 2.6.
UCAL_DOW_LOCAL  Day of week, localized (1.

.7) ICU 2.6

UCAL_EXTENDED_YEAR  Year of this calendar system, encompassing all supra-year fields.

For example, in Gregorian/Julian calendars, positive Extended Year values indicate years AD, 1 BC = 0 extended, 2 BC = -1 extended, and so on. ICU 2.8

UCAL_JULIAN_DAY  Modified Julian day number, encompassing all date-related fields.

Demarcates at local midnight. ICU 2.8

UCAL_MILLISECONDS_IN_DAY  Ranges from 0 to 23:59:59.999 (regardless of DST).

This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that is must be combined with the DST_OFFSET field to obtain a unique local time value. ICU 2.8

UCAL_FIELD_COUNT  Field count ICU 2.6.
UCAL_DAY_OF_MONTH  Synonym for UCAL_DATE ICU 2.8.

enum UCalendarDaysOfWeek
 

Possible days of the week in a UCalendar ICU 2.0.

Enumeration values:
UCAL_SUNDAY  Sunday.
UCAL_MONDAY  Monday.
UCAL_TUESDAY  Tuesday.
UCAL_WEDNESDAY  Wednesday.
UCAL_THURSDAY  Thursday.
UCAL_FRIDAY  Friday.
UCAL_SATURDAY  Saturday.

enum UCalendarDisplayNameType
 

Possible formats for a UCalendar's display name ICU 2.0.

Enumeration values:
UCAL_STANDARD  Standard display name.
UCAL_SHORT_STANDARD  Short standard display name.
UCAL_DST  Daylight savings display name.
UCAL_SHORT_DST  Short daylight savings display name.

enum UCalendarLimitType
 

Possible limit values for a UCalendar ICU 2.0.

Enumeration values:
UCAL_MINIMUM  Minimum value.
UCAL_MAXIMUM  Maximum value.
UCAL_GREATEST_MINIMUM  Greatest minimum value.
UCAL_LEAST_MAXIMUM  Leaest maximum value.
UCAL_ACTUAL_MINIMUM  Actual minimum value.
UCAL_ACTUAL_MAXIMUM  Actual maximum value.

enum UCalendarMonths
 

Possible months in a UCalendar.

Note: Calendar month is 0-based. ICU 2.0

Enumeration values:
UCAL_JANUARY  January.
UCAL_FEBRUARY  February.
UCAL_MARCH  March.
UCAL_APRIL  April.
UCAL_MAY  May.
UCAL_JUNE  June.
UCAL_JULY  July.
UCAL_AUGUST  August.
UCAL_SEPTEMBER  September.
UCAL_OCTOBER  October.
UCAL_NOVEMBER  November.
UCAL_DECEMBER  December.
UCAL_UNDECIMBER  Undecimber.

enum UCalendarType
 

Possible types of UCalendars ICU 2.0.

Enumeration values:
UCAL_TRADITIONAL  A traditional calendar for the locale.
UCAL_GREGORIAN  The Gregorian calendar.


Function Documentation

U_CAPI void U_EXPORT2 ucal_add UCalendar cal,
UCalendarDateFields  field,
int32_t  amount,
UErrorCode status
 

Add a specified signed amount to a particular field in a UCalendar.

This can modify more significant fields in the calendar.

Parameters:
cal The UCalendar to which to add.
field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
amount The signed amount to add to field. If the amount causes the value to exceed to maximum or minimum values for that field, other fields are modified to preserve the magnitude of the change.
status A pointer to an UErrorCode to receive any errors
See also:
ucal_roll ICU 2.0

U_CAPI void U_EXPORT2 ucal_clear UCalendar calendar  ) 
 

Clear all fields in a UCalendar.

All fields are represented as 32-bit integers.

Parameters:
calendar The UCalendar to clear.
See also:
ucal_get

ucal_set

ucal_isSet

ucal_clearField ICU 2.0

U_CAPI void U_EXPORT2 ucal_clearField UCalendar cal,
UCalendarDateFields  field
 

Clear a field in a UCalendar.

All fields are represented as 32-bit integers.

Parameters:
cal The UCalendar containing the field to clear.
field The field to clear; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
See also:
ucal_get

ucal_set

ucal_isSet

ucal_clear ICU 2.0

U_CAPI void U_EXPORT2 ucal_close UCalendar cal  ) 
 

Close a UCalendar.

Once closed, a UCalendar may no longer be used.

Parameters:
cal The UCalendar to close. ICU 2.0

U_CAPI int32_t U_EXPORT2 ucal_countAvailable void   ) 
 

Determine how many locales have calendars available.

This function is most useful as determining the loop ending condition for calls to {ucal_getAvailable}.

Returns:
The number of locales for which calendars are available.
See also:
ucal_getAvailable ICU 2.0

U_CAPI UBool U_EXPORT2 ucal_equivalentTo const UCalendar cal1,
const UCalendar cal2
 

Returns TRUE if two UCalendars are equivalent.

Equivalent UCalendars will behave identically, but they may be set to different times.

Parameters:
cal1 The first of the UCalendars to compare.
cal2 The second of the UCalendars to compare.
Returns:
TRUE if cal1 and cal2 are equivalent, FALSE otherwise. ICU 2.0

U_CAPI int32_t U_EXPORT2 ucal_get const UCalendar cal,
UCalendarDateFields  field,
UErrorCode status
 

Get the current value of a field from a UCalendar.

All fields are represented as 32-bit integers.

Parameters:
cal The UCalendar to query.
field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
status A pointer to an UErrorCode to receive any errors
Returns:
The value of the desired field.
See also:
ucal_set

ucal_isSet

ucal_clearField

ucal_clear ICU 2.0

U_CAPI int32_t U_EXPORT2 ucal_getAttribute const UCalendar cal,
UCalendarAttribute  attr
 

Get a numeric attribute associated with a UCalendar.

Numeric attributes include the first day of the week, or the minimal numbers of days in the first week of the month.

Parameters:
cal The UCalendar to query.
attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, or UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
Returns:
The value of attr.
See also:
ucal_setAttribute ICU 2.0

U_CAPI const char* U_EXPORT2 ucal_getAvailable int32_t  index  ) 
 

Get a locale for which calendars are available.

A UCalendar in a locale returned by this function will contain the correct day and month names for the locale.

Parameters:
index The index of the desired locale.
Returns:
A locale for which calendars are available, or 0 if none.
See also:
ucal_countAvailable ICU 2.0

U_CAPI int32_t U_EXPORT2 ucal_getDefaultTimeZone UChar *  result,
int32_t  resultCapacity,
UErrorCode ec
 

Return the default time zone.

The default is determined initially by querying the host operating system. It may be changed with ucal_setDefaultTimeZone() or with the C++ TimeZone API.

Parameters:
result A buffer to receive the result, or NULL
resultCapacity The capacity of the result buffer
ec input/output error code
Returns:
The result string length, not including the terminating null
ICU 2.6

U_CAPI int32_t U_EXPORT2 ucal_getDSTSavings const UChar *  zoneID,
UErrorCode ec
 

Return the amount of time in milliseconds that the clock is advanced during daylight savings time for the given time zone, or zero if the time zone does not observe daylight savings time.

Parameters:
zoneID null-terminated time zone ID
ec input/output error code
Returns:
the number of milliseconds the time is advanced with respect to standard time when the daylight savings rules are in effect. This is always a non-negative number, most commonly either 3,600,000 (one hour) or zero.
ICU 2.6

U_CAPI int32_t U_EXPORT2 ucal_getLimit const UCalendar cal,
UCalendarDateFields  field,
UCalendarLimitType  type,
UErrorCode status
 

Determine a limit for a field in a UCalendar.

A limit is a maximum or minimum value for a field.

Parameters:
cal The UCalendar to query.
field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
type The desired critical point; one of UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM, UCAL_LEAST_MAXIMUM, UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM
status A pointer to an UErrorCode to receive any errors.
Returns:
The requested value. ICU 2.0

U_CAPI const char* U_EXPORT2 ucal_getLocaleByType const UCalendar cal,
ULocDataLocaleType  type,
UErrorCode status
 

Get the locale for this calendar object.

You can choose between valid and actual locale.

Parameters:
cal The calendar object
type type of the locale we're looking for (valid or actual)
status error code for the operation
Returns:
the locale name ICU 2.8 likely to change in ICU 3.0, based on feedback

U_CAPI UDate U_EXPORT2 ucal_getMillis const UCalendar cal,
UErrorCode status
 

Get a UCalendar's current time in millis.

The time is represented as milliseconds from the epoch.

Parameters:
cal The UCalendar to query.
status A pointer to an UErrorCode to receive any errors
Returns:
The calendar's current time in millis.
See also:
ucal_setMillis

ucal_setDate

ucal_setDateTime ICU 2.0

U_CAPI UDate U_EXPORT2 ucal_getNow void   ) 
 

Get the current date and time.

The value returned is represented as milliseconds from the epoch.

Returns:
The current date and time. ICU 2.0

U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneDisplayName const UCalendar cal,
UCalendarDisplayNameType  type,
const char *  locale,
UChar *  result,
int32_t  resultLength,
UErrorCode status
 

Get the display name for a UCalendar's TimeZone.

A display name is suitable for presentation to a user.

Parameters:
cal The UCalendar to query.
type The desired display name format; one of UCAL_STANDARD, UCAL_SHORT_STANDARD, UCAL_DST, UCAL_SHORT_DST
locale The desired locale for the display name.
result A pointer to a buffer to receive the formatted number.
resultLength The maximum size of result.
status A pointer to an UErrorCode to receive any errors
Returns:
The total buffer size needed; if greater than resultLength, the output was truncated. ICU 2.0

U_CAPI UBool U_EXPORT2 ucal_inDaylightTime const UCalendar cal,
UErrorCode status
 

Determine if a UCalendar is currently in daylight savings time.

Daylight savings time is not used in all parts of the world.

Parameters:
cal The UCalendar to query.
status A pointer to an UErrorCode to receive any errors
Returns:
TRUE if cal is currently in daylight savings time, FALSE otherwise ICU 2.0

U_CAPI UBool U_EXPORT2 ucal_isSet const UCalendar cal,
UCalendarDateFields  field
 

Determine if a field in a UCalendar is set.

All fields are represented as 32-bit integers.

Parameters:
cal The UCalendar to query.
field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
Returns:
TRUE if field is set, FALSE otherwise.
See also:
ucal_get

ucal_set

ucal_clearField

ucal_clear ICU 2.0

U_CAPI UCalendar* U_EXPORT2 ucal_open const UChar *  zoneID,
int32_t  len,
const char *  locale,
UCalendarType  type,
UErrorCode status
 

Open a UCalendar.

A UCalendar may be used to convert a millisecond value to a year, month, and day.

Parameters:
zoneID The desired TimeZone ID. If 0, use the default time zone.
len The length of zoneID, or -1 if null-terminated.
locale The desired locale
type The type of UCalendar to open.
status A pointer to an UErrorCode to receive any errors
Returns:
A pointer to a UCalendar, or 0 if an error occurred. ICU 2.0

U_CAPI UEnumeration* U_EXPORT2 ucal_openCountryTimeZones const char *  country,
UErrorCode ec
 

Create an enumeration over all time zones associated with the given country.

Some zones are affiliated with no country (e.g., "UTC"); these may also be retrieved, as a group.

Parameters:
country the ISO 3166 two-letter country code, or NULL to retrieve zones not affiliated with any country
ec input/output error code
Returns:
an enumeration object that the caller must dispose of using uenum_close(), or NULL upon failure. In case of failure *ec will indicate the error.
ICU 2.6

U_CAPI UEnumeration* U_EXPORT2 ucal_openTimeZones UErrorCode ec  ) 
 

Create an enumeration over all time zones.

Parameters:
ec input/output error code
Returns:
an enumeration object that the caller must dispose of using uenum_close(), or NULL upon failure. In case of failure *ec will indicate the error.
ICU 2.6

U_CAPI void U_EXPORT2 ucal_roll UCalendar cal,
UCalendarDateFields  field,
int32_t  amount,
UErrorCode status
 

Add a specified signed amount to a particular field in a UCalendar.

This will not modify more significant fields in the calendar.

Parameters:
cal The UCalendar to which to add.
field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
amount The signed amount to add to field. If the amount causes the value to exceed to maximum or minimum values for that field, the field is pinned to a permissible value.
status A pointer to an UErrorCode to receive any errors
See also:
ucal_add ICU 2.0

U_CAPI void U_EXPORT2 ucal_set UCalendar cal,
UCalendarDateFields  field,
int32_t  value
 

Set the value of a field in a UCalendar.

All fields are represented as 32-bit integers.

Parameters:
cal The UCalendar to set.
field The field to set; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
value The desired value of field.
See also:
ucal_get

ucal_isSet

ucal_clearField

ucal_clear ICU 2.0

U_CAPI void U_EXPORT2 ucal_setAttribute UCalendar cal,
UCalendarAttribute  attr,
int32_t  newValue
 

Set a numeric attribute associated with a UCalendar.

Numeric attributes include the first day of the week, or the minimal numbers of days in the first week of the month.

Parameters:
cal The UCalendar to set.
attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, or UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
newValue The new value of attr.
See also:
ucal_getAttribute ICU 2.0

U_CAPI void U_EXPORT2 ucal_setDate UCalendar cal,
int32_t  year,
int32_t  month,
int32_t  date,
UErrorCode status
 

Set a UCalendar's current date.

The date is represented as a series of 32-bit integers.

Parameters:
cal The UCalendar to set.
year The desired year.
month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY, UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER
date The desired day of the month.
status A pointer to an UErrorCode to receive any errors
See also:
ucal_getMillis

ucal_setMillis

ucal_setDateTime ICU 2.0

U_CAPI void U_EXPORT2 ucal_setDateTime UCalendar cal,
int32_t  year,
int32_t  month,
int32_t  date,
int32_t  hour,
int32_t  minute,
int32_t  second,
UErrorCode status
 

Set a UCalendar's current date.

The date is represented as a series of 32-bit integers.

Parameters:
cal The UCalendar to set.
year The desired year.
month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY, UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER
date The desired day of the month.
hour The desired hour of day.
minute The desired minute.
second The desirec second.
status A pointer to an UErrorCode to receive any errors
See also:
ucal_getMillis

ucal_setMillis

ucal_setDate ICU 2.0

U_CAPI void U_EXPORT2 ucal_setDefaultTimeZone const UChar *  zoneID,
UErrorCode ec
 

Set the default time zone.

Parameters:
zoneID null-terminated time zone ID
ec input/output error code
ICU 2.6

U_CAPI void U_EXPORT2 ucal_setMillis UCalendar cal,
UDate  dateTime,
UErrorCode status
 

Set a UCalendar's current time in millis.

The time is represented as milliseconds from the epoch.

Parameters:
cal The UCalendar to set.
dateTime The desired date and time.
status A pointer to an UErrorCode to receive any errors
See also:
ucal_getMillis

ucal_setDate

ucal_setDateTime ICU 2.0

U_CAPI void U_EXPORT2 ucal_setTimeZone UCalendar cal,
const UChar *  zoneID,
int32_t  len,
UErrorCode status
 

Set the TimeZone used by a UCalendar.

A UCalendar uses a timezone for converting from Greenwich time to local time.

Parameters:
cal The UCalendar to set.
zoneID The desired TimeZone ID. If 0, use the default time zone.
len The length of zoneID, or -1 if null-terminated.
status A pointer to an UErrorCode to receive any errors. ICU 2.0


Generated on Wed May 18 17:29:15 2005 for ICU 2.8 by  doxygen 1.4.2