cs_dt_crack

Description

Converts a machine-readable datetime value into a user-accessible format.

Syntax

CS_RETCODE cs_dt_crack(context, datetype, dateval,
                   daterec)
 
 CS_CONTEXT        *context;
 CS_INT                   datetype;
 CS_VOID                *dateval;
 CS_DATEREC        *daterec;

Parameters

context

A pointer to a CS_CONTEXT structure.

datetype

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.

dateval

A pointer to the date, time, or datetime value to be converted.

daterec

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.

Returns

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.

Usage

See also

cs_dt_info