Tizen Native API
Functions
Ucalendar
i18n

Functions

int i18n_ucalendar_set_default_timezone (const i18n_uchar *zone_id)
 Sets the default time zone.
int i18n_ucalendar_get_now (i18n_udate *date)
 Gets the current date and time.
int i18n_ucalendar_create (const i18n_uchar *zone_id, int32_t len, const char *locale, i18n_ucalendar_type_e type, i18n_ucalendar_h *calendar)
 Creates an i18n_ucalendar_h. An i18n_ucalendar_h may be used to convert a millisecond value to a year, month, and day.
int i18n_ucalendar_destroy (i18n_ucalendar_h calendar)
 Destroys an i18n_ucalendar_h.
int i18n_ucalendar_clone (const i18n_ucalendar_h cal, i18n_ucalendar_h *identical_to_cal)
 Open a copy of a i18n_ucalendar. This function performs a deep copy.
int i18n_ucalendar_get_timezone_displayname (const i18n_ucalendar_h calendar, i18n_ucalendar_displayname_type_e type, const char *locale, i18n_uchar *result, int32_t result_len, int32_t *buf_size_needed)
 Gets the display name for an i18n_ucalendar_h's TimeZone.
int i18n_ucalendar_is_in_daylight_time (const i18n_ucalendar_h calendar, i18n_ubool *is_in)
 Determines if an i18n_ucalendar_h is currently in daylight savings time.
int i18n_ucalendar_set (i18n_ucalendar_h cal, i18n_ucalendar_date_fields_e field, int32_t val)
 Sets the value of a field in a i18n_ucalendar_h.
int i18n_ucalendar_set_attribute (i18n_ucalendar_h calendar, i18n_ucalendar_attribute_e attr, int32_t val)
 Sets a numeric attribute associated with an i18n_ucalendar_h.
int i18n_ucalendar_get_attribute (i18n_ucalendar_h calendar, i18n_ucalendar_attribute_e attr, int32_t *val)
 Gets a numeric attribute associated with an i18n_ucalendar.
int i18n_ucalendar_get_milliseconds (const i18n_ucalendar_h calendar, i18n_udate *date)
 Gets an i18n_ucalendar_h's current time in milliseconds.
int i18n_ucalendar_set_milliseconds (i18n_ucalendar_h calendar, i18n_udate milliseconds)
 Sets an i18n_ucalendar_h's current time in milliseconds.
int i18n_ucalendar_set_date_time (i18n_ucalendar_h calendar, int32_t year, int32_t month, int32_t date, int32_t hour, int32_t min, int32_t sec)
 Sets an i18n_ucalendar_h's current date.
int i18n_ucalendar_is_equivalent_to (const i18n_ucalendar_h calendar1, const i18n_ucalendar_h calendar2, i18n_ubool *equiv)
 Returns true if two i18n_ucalendar_hs are equivalent.
int i18n_ucalendar_add (i18n_ucalendar_h calendar, i18n_ucalendar_date_fields_e field, int32_t amount)
 Adds a specified signed amount to a particular field in a i18n_ucalendar_h.
int i18n_ucalendar_get (const i18n_ucalendar_h calendar, i18n_ucalendar_date_fields_e field, int32_t *val)
 Gets the current value of a field from an i18n_ucalendar_h.

The Ucalendar is used for converting between an udate module and a set of integer fields such as I18N_UCALENDAR_YEAR, I18N_UCALENDAR_MONTH, I18N_UCALENDAR_DATE, I18N_UCALENDAR_HOUR, and so on.

Required Header

#include <utils_i18n.h>

Overview

The Ucalendar is used for converting between an udate module and a set of integer fields such as I18N_UCALENDAR_YEAR, I18N_UCALENDAR_MONTH, I18N_UCALENDAR_DATE, I18N_UCALENDAR_HOUR, and so on. (An udate module represents a specific instant in time with millisecond precision. See udate for information about the udate.)

Sample Code 1

Converts the given date and time to the corresponding UTC time(number of seconds that have elapsed since January 1, 1970), considering the given time zone

 #define ms2sec(ms) (long long int)(ms)/1000.0
 
  // get time in sec from input date and time
  long long int _time_convert_itol(char *tzid, int y, int mon, int d, int h, int min, int s)
 {
     long long int lli;
     i18n_ucalendar_h ucal;
     i18n_udate date;
     int ret = I18N_ERROR_NONE;
     int year, month, day, hour, minute, second;
     int len;
 
     i18n_uchar *_tzid = NULL;
 
     if (tzid == NULL) {
         tzid = "Etc/GMT";
     }
     _tzid = (i18n_uchar*)calloc(strlen(tzid) + 1, sizeof(i18n_uchar));
     if (_tzid == NULL) {
         return -1;
     }
     // converts 'tzid' to unicode string
     i18n_ustring_copy_ua(_tzid, tzid);
 
     // gets length of '_tzid'
     i18n_ustring_get_length(_tzid, &len);
     // creates i18n_ucalendar_h
     ret = i18n_ucalendar_create(_tzid, len, "en_US", I18N_UCALENDAR_TRADITIONAL, &ucal);
     if (ret) {
         dlog_print(DLOG_INFO, LOG_TAG, "i18n_ucalendar_create failed.\n");
         return -1;
     }
 
     // sets i18n_ucalendar_h's date
     i18n_ucalendar_set_date_time(ucal, y, mon-1, d, h, min, s);
 
     // gets the current value of a field from i18n_ucalendar_h
     i18n_ucalendar_get(ucal, I18N_UCALENDAR_YEAR, &year);
     i18n_ucalendar_get(ucal, I18N_UCALENDAR_MONTH, &month);
     i18n_ucalendar_get(ucal, I18N_UCALENDAR_DATE, &day);
     i18n_ucalendar_get(ucal, I18N_UCALENDAR_HOUR, &hour);
     i18n_ucalendar_get(ucal, I18N_UCALENDAR_MINUTE, &minute);
     i18n_ucalendar_get(ucal, I18N_UCALENDAR_SECOND, &second);
     dlog_print(DLOG_INFO, LOG_TAG, "Date from ucal, year:%d month:%d day:%d hour:%d minute:%d second:%d.\n",year, month, day, hour, minute, second);
 
     // gets i18n_ucalendar's current time and converts it from milliseconds to seconds
     i18n_ucalendar_get_milliseconds(ucal, &date);
     lli = ms2sec(date);
     // destroys i18n_ucalendar_h
     i18n_ucalendar_destroy(ucal);
     if (_tzid) {
         free(_tzid);
     }
 
     return lli;
 }

Sample Code 2

Describes an example that uses _time_convert_itol from 'Sample Code 2'

       // converts the given time to UTC time(number of seconds that have elapsed since January 1, 1970)
     long long int time = _time_convert_itol("Etc/GMT", 2014, 5, 28, 15, 14, 0);
     dlog_print(DLOG_INFO, LOG_TAG, "Time Zone: %s\t, %d/%d/%d/%d/%d/%d\n", "Etc/GMT", 2014, 5, 28, 15, 14, 0);
     dlog_print(DLOG_INFO, LOG_TAG, "_time_convert_itol test : %lld\n", time);

Enumeration Type Documentation

System time zone type constants.

Enumerator:
I18N_UCALENDAR_ZONE_TYPE_ANY 

Any system zones.

I18N_UCALENDAR_ZONE_TYPE_CANONICAL 

Canonical system zones.

I18N_UCALENDAR_ZONE_TYPE_CANONICAL_LOCATION 

Canonical system zones associated with actual locations.

Enumeration for types of i18n_ucalendar_h attributes.

Enumerator:
I18N_UCALENDAR_LENIENT 

Lenient parsing

I18N_UCALENDAR_FIRST_DAY_OF_WEEK 

First day of the week

I18N_UCALENDAR_MINIMAL_DAYS_IN_FIRST_WEEK 

Minimum number of days in the first week

Enumeration for possible fields in an i18n_ucalendar_h.

Enumerator:
I18N_UCALENDAR_ERA 

Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar

I18N_UCALENDAR_YEAR 

Field number indicating the year

I18N_UCALENDAR_MONTH 

Field number indicating the month. This is a calendar-specific value.
The first month of the year is JANUARY; the last depends on the number of months in a year

I18N_UCALENDAR_WEEK_OF_YEAR 

Field number indicating the week number within the current year.
The first week of the year, as defined by the I18N_UCALENDAR_FIRST_DAY_OF_WEEK and I18N_UCALENDAR_MINIMAL_DAYS_IN_FIRST_WEEK attributes, has value 1. Subclasses define the value of I18N_UCALENDAR_WEEK_OF_YEAR for days before the first week of the year

I18N_UCALENDAR_WEEK_OF_MONTH 

Field number indicating the week number within the current month.
The first week of the month, as defined by the I18N_UCALENDAR_FIRST_DAY_OF_WEEK and I18N_UCALENDAR_MINIMAL_DAYS_IN_FIRST_WEEK attributes, has value 1. Subclasses define the value of WEEK_OF_MONTH for days before the first week of the month

I18N_UCALENDAR_DATE 

Field number indicating the day of the month.
This is a synonym for DAY_OF_MONTH. The first day of the month has value 1

I18N_UCALENDAR_DAY_OF_YEAR 

Field number indicating the day number within the current year.
The first day of the year has value 1.

I18N_UCALENDAR_DAY_OF_WEEK 

Field number indicating the day of the week.
This field takes values "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday, "Friday", and "Saturday"

I18N_UCALENDAR_DAY_OF_WEEK_IN_MONTH 

Field number indicating the ordinal number of the day of the week within the current month.
Together with the "day of week" field, this uniquely specifies a day within a month. "day of month" 1 through 7 always correspond to "day of week in month" 1; 8 through 15 correspond to "day of week in month" 2, and so on. "day of week in month" 0 indicates the week before "day of week in month" 1. Negative values count back from the end of the month, so the last Sunday of a month is specified as "day of week" = "Sunday", "day of week in month" = -1. Because negative values count backward they will usually be aligned differently within the month than positive values. For example, if a month has 31 days, "day of week in month" -1 will overlap "day of week in month" 5 and the end of 4

I18N_UCALENDAR_AM_PM 

Field number indicating whether the "hour" is before or after noon.
E.g., at 10:04:15.250 PM the AM_PM is PM

I18N_UCALENDAR_HOUR 

Field number indicating the hour of the morning or afternoon.
"hour" is used for the 12-hour clock. E.g., at 10:04:15.250 PM the "Hour" is 10

I18N_UCALENDAR_HOUR_OF_DAY 

Field number indicating the hour of the day.
"Hour of day" is used for the 24-hour clock. E.g., at 10:04:15.250 PM the "Hour of day" is 22

I18N_UCALENDAR_MINUTE 

Field number indicating the minute within the hour.
E.g., at 10:04:15.250 PM the I18N_UCALENDAR_MINUTE is 4

I18N_UCALENDAR_SECOND 

Field number indicating the second within the minute.
E.g., at 10:04:15.250 PM the I18N_UCALENDAR_SECOND is 15

I18N_UCALENDAR_MILLISECOND 

Field number indicating the millisecond within the second.
E.g., at 10:04:15.250 PM the I18N_UCALENDAR_MILLISECOND is 250

I18N_UCALENDAR_ZONE_OFFSET 

Field number indicating the raw offset from GMT in milliseconds

I18N_UCALENDAR_DST_OFFSET 

Field number indicating the daylight savings offset in milliseconds

I18N_UCALENDAR_YEAR_WOY 

Field number indicating the extended year corresponding to the I18N_UCALENDAR_WEEK_OF_YEAR field.
This may be one greater or less than the value of I18N_UCALENDAR_EXTENDED_YEAR

I18N_UCALENDAR_DOW_LOCAL 

Field number indicating the localized day of the week.
This will be a value from 1 to 7 inclusive, with 1 being the localized first day of the week

I18N_UCALENDAR_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

I18N_UCALENDAR_JULIAN_DAY 

Field number indicating the modified Julian day number.
This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields

I18N_UCALENDAR_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 in 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 it must be combined with the DST offset field to obtain a unique local time value

I18N_UCALENDAR_IS_LEAP_MONTH 

Whether or not the current month is a leap month (0 or 1)

I18N_UCALENDAR_FIELD_COUNT 

Field count

I18N_UCALENDAR_DAY_OF_MONTH 

Field number indicating the day of the month.
This is a synonym for I18N_UCALENDAR_DATE. The first day of the month has value 1

Enumeration for possible formats of an i18n_ucalendar_h's display name.

Enumerator:
I18N_UCALENDAR_STANDARD 

Standard display name

I18N_UCALENDAR_SHORT_STANDARD 

Short standard display name

I18N_UCALENDAR_DST 

Daylight savings display name

I18N_UCALENDAR_SHORT_DST 

Short daylight savings display name

Enumeration for possible months in an i18n_ucalendar_h.

Enumerator:
I18N_UCALENDAR_JANUARY 

January

I18N_UCALENDAR_FEBRUARY 

February

I18N_UCALENDAR_MARCH 

March

I18N_UCALENDAR_APRIL 

April

I18N_UCALENDAR_MAY 

May

I18N_UCALENDAR_JUNE 

June

I18N_UCALENDAR_JULY 

July

I18N_UCALENDAR_AUGUST 

August

I18N_UCALENDAR_SEPTEMBER 

September

I18N_UCALENDAR_OCTOBER 

October

I18N_UCALENDAR_NOVEMBER 

November

I18N_UCALENDAR_DECEMBER 

December

Enumeration for possible months in an i18n_ucalendar_h.

Enumerator:
I18N_UCALENDAR_TRADITIONAL 

Despite the name, I18N_UCALENDAR_TRADITIONAL designates the locale's default calendar, which may be the Gregorian calendar or some other calendar

I18N_UCALENDAR_DEFAULT 

A better name for I18N_UCALENDAR_TRADITIONAL

I18N_UCALENDAR_GREGORIAN 

Unambiguously designates the Gregorian calendar for the locale


Function Documentation

int i18n_ucalendar_add ( i18n_ucalendar_h  calendar,
i18n_ucalendar_date_fields_e  field,
int32_t  amount 
)

Adds a specified signed amount to a particular field in a i18n_ucalendar_h.

This can modify more significant fields in the calendar.

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to which to add
[in]fieldThe field to which to add the signed value
One of I18N_UCALENDAR_ERA, I18N_UCALENDAR_YEAR, I18N_UCALENDAR_MONTH, I18N_UCALENDAR_WEEK_OF_YEAR, I18N_UCALENDAR_WEEK_OF_MONTH, I18N_UCALENDAR_DATE, I18N_UCALENDAR_DAY_OF_YEAR, I18N_UCALENDAR_DAY_OF_WEEK, I18N_UCALENDAR_DAY_OF_WEEK_IN_MONTH, I18N_UCALENDAR_AM_PM, I18N_UCALENDAR_HOUR, I18N_UCALENDAR_HOUR_OF_DAY, I18N_UCALENDAR_MINUTE, I18N_UCALENDAR_SECOND, I18N_UCALENDAR_MILLISECOND, I18N_UCALENDAR_ZONE_OFFSET, or I18N_UCALENDAR_DST_OFFSET.
[in]amountThe signed amount to add to the 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.
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_clone ( const i18n_ucalendar_h  cal,
i18n_ucalendar_h *  identical_to_cal 
)

Open a copy of a i18n_ucalendar. This function performs a deep copy.

Since :
2.3
Parameters:
[in]calThe i18n_ucalendar_h to copy
[out]identical_to_calA pointer to a i18n_ucalendar_h identical to cal.
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_create ( const i18n_uchar *  zone_id,
int32_t  len,
const char *  locale,
i18n_ucalendar_type_e  type,
i18n_ucalendar_h *  calendar 
)

Creates an i18n_ucalendar_h. An i18n_ucalendar_h may be used to convert a millisecond value to a year, month, and day.

Note: When an unknown TimeZone ID is specified, the i18n_ucalendar_h returned by the function is initialized with GMT ("Etc/GMT") without any errors/warnings.

Since :
2.3
Remarks:
Must release calendar using i18n_ucalendar_destroy().
Parameters:
[in]zone_idThe desired TimeZone ID
If 0, use the default time zone.
[in]lenThe length of the zone ID, otherwise -1 if null-terminated
[in]localeThe desired locale
[in]typeThe type of I18N_UCALENDAR_DEFAULT to create
This can be I18N_UCALENDAR_GREGORIAN to create the Gregorian calendar for the locale, or I18N_UCALENDAR_DEFAULT to create the default calendar for the locale (the default calendar may also be Gregorian).
[out]calendarA pointer to an i18n_ucalendar_h, otherwise 0 if an error occurs
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_destroy ( i18n_ucalendar_h  calendar)

Destroys an i18n_ucalendar_h.

Once destroyed, an i18n_ucalendar_h may no longer be used.

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to destroy
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_get ( const i18n_ucalendar_h  calendar,
i18n_ucalendar_date_fields_e  field,
int32_t *  val 
)

Gets the current value of a field from an i18n_ucalendar_h.

All fields are represented as 32-bit integers.

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to query
[in]fieldThe desired field
One of I18N_UCALENDAR_ERA, I18N_UCALENDAR_YEAR, I18N_UCALENDAR_MONTH, I18N_UCALENDAR_WEEK_OF_YEAR, I18N_UCALENDAR_WEEK_OF_MONTH, I18N_UCALENDAR_DATE, I18N_UCALENDAR_DAY_OF_YEAR, I18N_UCALENDAR_DAY_OF_WEEK, I18N_UCALENDAR_DAY_OF_WEEK_IN_MONTH, I18N_UCALENDAR_AM_PM, I18N_UCALENDAR_HOUR, I18N_UCALENDAR_HOUR_OF_DAY, I18N_UCALENDAR_MINUTE, I18N_UCALENDAR_SECOND, I18N_UCALENDAR_MILLISECOND, I18N_UCALENDAR_ZONE_OFFSET, or I18N_UCALENDAR_DST_OFFSET.
[out]valThe value of the desired field.
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_get_attribute ( i18n_ucalendar_h  calendar,
i18n_ucalendar_attribute_e  attr,
int32_t *  val 
)

Gets a numeric attribute associated with an i18n_ucalendar.

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

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar to query.
[in]attrThe desired attribute
One of I18N_UCALENDAR_LENIENT, I18N_UCALENDAR_FIRST_DAY_OF_WEEK, or I18N_UCALENDAR_MINIMAL_DAYS_IN_FIRST_WEEK.
[out]valThe value of attr
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_get_milliseconds ( const i18n_ucalendar_h  calendar,
i18n_udate date 
)

Gets an i18n_ucalendar_h's current time in milliseconds.

The time is represented as milliseconds from the epoch.

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to query
[out]dateThe calendar's current time in milliseconds
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
See also:
i18n_ucalendar_set_milliseconds()
i18n_ucalendar_set_date_time()

Gets the current date and time.

The value returned is represented as milliseconds from the epoch.

Since :
2.3
Parameters:
[out]dateThe current date and time
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_get_timezone_displayname ( const i18n_ucalendar_h  calendar,
i18n_ucalendar_displayname_type_e  type,
const char *  locale,
i18n_uchar *  result,
int32_t  result_len,
int32_t *  buf_size_needed 
)

Gets the display name for an i18n_ucalendar_h's TimeZone.

A display name is suitable for presentation to a user.

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to query
[in]typeThe desired display name format
One of I18N_UCALENDAR_STANDARD, I18N_UCALENDAR_SHORT_STANDARD, I18N_UCALENDAR_DST, or I18N_UCALENDAR_SHORT_DST
[in]localeThe desired locale for the display name
[out]resultA pointer to a buffer to receive the formatted number
[in]result_lenThe maximum size of the result
[out]buf_size_neededThe total buffer size needed
If greater than result_len, the output is truncated
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_is_equivalent_to ( const i18n_ucalendar_h  calendar1,
const i18n_ucalendar_h  calendar2,
i18n_ubool *  equiv 
)

Returns true if two i18n_ucalendar_hs are equivalent.

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

Since :
2.3
Parameters:
[in]calendar1The first of the i18n_ucalendar_hs to compare
[in]calendar2The second of the i18n_ucalendar_hs to compare
[out]equivIf true cal1 and cal2 are equivalent, otherwise false
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_is_in_daylight_time ( const i18n_ucalendar_h  calendar,
i18n_ubool *  is_in 
)

Determines if an i18n_ucalendar_h is currently in daylight savings time.

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

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to query
[out]is_inIf true calendar is currently in daylight savings time, otherwise false
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_set ( i18n_ucalendar_h  cal,
i18n_ucalendar_date_fields_e  field,
int32_t  val 
)

Sets the value of a field in a i18n_ucalendar_h.

All fields are represented as 32-bit integers.

Since :
2.3
Parameters:
[in]calThe i18n_ucalendar to set.
[in]fieldThe field to set
One of I18N_UCALENDAR_ERA, I18N_UCALENDAR_YEAR, I18N_UCALENDAR_MONTH, I18N_UCALENDAR_WEEK_OF_YEAR, I18N_UCALENDAR_WEEK_OF_MONTH, I18N_UCALENDAR_DATE, I18N_UCALENDAR_DAY_OF_YEAR, I18N_UCALENDAR_DAY_OF_WEEK, I18N_UCALENDAR_DAY_OF_WEEK_IN_MONTH, I18N_UCALENDAR_AM_PM, I18N_UCALENDAR_HOUR, I18N_UCALENDAR_HOUR_OF_DAY, I18N_UCALENDAR_MINUTE, I18N_UCALENDAR_SECOND, I18N_UCALENDAR_MILLISECOND, I18N_UCALENDAR_ZONE_OFFSET, I18N_UCALENDAR_DST_OFFSET.
[in]valThe desired value of field.
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_set_attribute ( i18n_ucalendar_h  calendar,
i18n_ucalendar_attribute_e  attr,
int32_t  val 
)

Sets a numeric attribute associated with an i18n_ucalendar_h.

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

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to set.
[in]attrThe desired attribute
One of I18N_UCALENDAR_LENIENT, I18N_UCALENDAR_FIRST_DAY_OF_WEEK, or I18N_UCALENDAR_MINIMAL_DAYS_IN_FIRST_WEEK.
[in]valThe new value of attr
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
int i18n_ucalendar_set_date_time ( i18n_ucalendar_h  calendar,
int32_t  year,
int32_t  month,
int32_t  date,
int32_t  hour,
int32_t  min,
int32_t  sec 
)

Sets an i18n_ucalendar_h's current date.

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

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to set
[in]yearThe desired year
[in]monthThe desired month
One of I18N_UCALENDAR_JANUARY, I18N_UCALENDAR_FEBRUARY, I18N_UCALENDAR_MARCH, I18N_UCALENDAR_APRIL, I18N_UCALENDAR_MAY, I18N_UCALENDAR_JUNE, I18N_UCALENDAR_JULY, I18N_UCALENDAR_AUGUST, I18N_UCALENDAR_SEPTEMBER, I18N_UCALENDAR_OCTOBER, I18N_UCALENDAR_NOVEMBER, or I18N_UCALENDAR_DECEMBER
[in]dateThe desired day of the month
[in]hourThe desired hour of the day
[in]minThe desired minute
[in]secThe desired second
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
See also:
i18n_ucalendar_get_milliseconds()
i18n_ucalendar_set_milliseconds()
int i18n_ucalendar_set_default_timezone ( const i18n_uchar *  zone_id)

Sets the default time zone.

Since :
2.3
Parameters:
[in]zone_idnull-terminated time zone ID
Return values:
I18N_ERROR_NONESuccessful
int i18n_ucalendar_set_milliseconds ( i18n_ucalendar_h  calendar,
i18n_udate  milliseconds 
)

Sets an i18n_ucalendar_h's current time in milliseconds.

The time is represented as milliseconds from the epoch.

Since :
2.3
Parameters:
[in]calendarThe i18n_ucalendar_h to set
[in]millisecondsThe desired date and time
Return values:
I18N_ERROR_NONESuccessful
I18N_ERROR_INVALID_PARAMETERInvalid function parameter
See also:
i18n_ucalendar_get_milliseconds()
i18n_ucalendar_set_date_time()

Except as noted, this content - excluding the Code Examples - is licensed under Creative Commons Attribution 3.0 and all of the Code Examples contained herein are licensed under BSD-3-Clause.
For details, see the Content License