cs_dt_info

Description

Sets or retrieves language-specific date, time, or datetime information.

Syntax

CS_RETCODE cs_dt_info(context, action, locale, type,
                 item, buffer, buflen, outlen)
 
 CS_CONTEXT      *context;
 CS_INT                 action;
 CS_LOCALE         *locale;
 CS_INT                 type;
 CS_INT                 item;
 CS_VOID              *buffer;
 CS_INT                 buflen;
 CS_INT                 *outlen;

Parameters

context

A pointer to a CS_CONTEXT structure.

When retrieving date, time, or datetime information, if locale is NULL, cs_dt_info uses the default locale information contained in this context structure.

action

One of the following symbolic values:

Value of action

cs_dt_info

CS_SET

Sets a date, time, or datetime conversion format.

CS_GET

Retrieves date, time or datetime information.

locale

A pointer to a CS_LOCALE structure. A locale structure contains locale information, including datetime information.

When setting datetime information, locale must be supplied.

When retrieving datetime information, locale can be NULL. If locale is NULL, cs_dt_info uses the default locale information contained in *context.

type

The type of information of interest. Table 2-5 lists the symbolic values that are legal for type.

item

When retrieving information, item is the item number of the type category to retrieve. For example, to retrieve the name of the first month, an application passes type as CS_MONTH and item as 0.

When setting a datetime conversion format, pass item as CS_UNUSED.

buffer

If datetime information is being retrieved, buffer points to the space in which cs_dt_info will place the requested information.

If buflen indicates that *buffer is not large enough to hold the requested information, cs_dt_info sets *outlen to the length of the requested information and returns CS_FAIL.

If a datetime conversion format is being set, buffer points to a symbolic value representing a conversion format.

buflen

The length, in bytes, of *buffer.

If item is CS_12HOUR, pass buflen as CS_UNUSED.

outlen

A pointer to an integer variable.

cs_dt_info sets *outlen to the length, in bytes, of the requested information.

If the requested information is larger than buflen bytes, an application can use the value of *outlen to determine how many bytes are needed to hold the information.

Returns

cs_dt_info returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

The most common reason for a cs_dt_info failure is an invalid parameter.

Usage

Table 2-5: Summary of cs_dt_info parameter usage

Value of type

cs_dt_info

action can be

item can be

*buffer is

CS_MONTH

Retrieves the month name string.

CS_GET

0–11

A character string.

CS_SHORTMONTH

Retrieves the short month name string.

CS_GET

0–11

A character string.

CS_DAYNAME

Retrieves the day name string.

CS_GET

0–6

A character string.

CS_DATEORDER

Retrieves the date order string.

CS_GET

CS_UNUSED

A string containing the three characters “m,” “d,” and “y” to indicate the position of the month, day, and year in the datetime format.

CS_12HOUR

Retrieves whether or not the language uses 12-hour time formats.

CS_GET

CS_UNUSED

CS_TRUE if 12-hour formats are used; CS_FALSE if 24-hour formats are used.

CS_DT_CONVFMT

Sets or retrieves the datetime conversion format.

CS_GET or CS_SET

CS_UNUSED

A symbolic value. See the Comments section, below, for a list of possible values.

See also

cs_dt_crack, cs_locale