Converts a machine-readable datetime value into a user-accessible format.
CS_RETCODE cs_dt_crack(context, datetype, dateval, daterec) CS_CONTEXT *context; CS_INT datetype; CS_VOID *dateval; CS_DATEREC *daterec;
A pointer to a CS_CONTEXT structure.
A symbolic value indicating the datatype of *dateval:
Value of datetype |
Indicates |
---|---|
CS_DATE_TYPE |
CS_DATE*dateval. |
CS_TIME_TYPE |
CS_TIME* dateval |
CS_DATETIME_TYPE |
A CS_DATETIME *dateval. |
CS_DATETIME4_TYPE |
A CS_DATETIME4 *dateval. |
A pointer to the date, time, or datetime value to be converted.
A pointer to a CS_DATEREC structure. cs_dt_crack fills this structure with the translated date, time, or datetime value. A CS_DATEREC is defined as follows:
typedef struct cs_daterec {
CS_INT dateyear; /* year */
CS_INT datemonth; /* month */
CS_INT datedmonth; /* day of month */
CS_INT datedyear; /* day of year */
CS_INT datedweek; /* day of week */
CS_INT datehour; /* hour */
CS_INT dateminute; /* minute */
CS_INT datesecond; /* second */
CS_INT datemsecond; /* millisecond */
CS_INT datetzone; /* timezone */
} CS_DATEREC;
where:
dateyear is a value greater than or equal to 1900.
datemonth is a value from 0 to 11.
datedmonth is a value from 1 to 31.
datedyear is a value from 1 to 366.
datedweek is a value from 0 to 6.
datehour is a value from 0 to 23.
dateminute is a value from 0 to 59.
datesecond is a value from 0 to 59.
datemsecond is a value from 0 to 999.
datetzone is reserved for future use. cs_dt_crack does not set this field.
The meanings of these numbers vary according to an application’s locale. For example, if localization information specifies that Sunday is the first day of the week, then a datedweek value of 2 represents Tuesday. If localization information specifies that Monday is the first day of the week, then a datedweek value of 2 represents Wednesday.
An application can call cs_dt_info to find out what date-related localization values are in effect.
The time zone field (datetzone) is reserved for future use. This field will not be set.
For more information on localization, see the “International Support” topics page in the Open Client Client-Library/C Reference Manual.
cs_dt_crack returns:
Returns |
Indicates |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
The most common reason for a cs_dt_crack failure is an invalid parameter.
cs_dt_crack converts a date, time or datetime value into its integer components and places those components into a CS_DATEREC structure.
Datetime values are stored in an internal format. For example, a CS_DATETIME value is stored as the number of days since January 1, 1900 plus the number of three hundredths of a second since midnight. cs_dt_crack converts a value of this type into a format that an application can more easily access.