Open Client supports four datetime types, CS_DATE, CS_TIME, CS_DATETIME, and CS_DATETIME4. These datatypes are intended to hold 4-byte and 8-byte datetime values.
An Open Client application uses the CS-Library routine cs_dt_crack to extract date parts (year, month, day, etc.) from a datetime structure.
CS_DATE corresponds to the Adaptive Server date datatype. The range of legal CS_DATEvalues is from January 1, 0001 to December 31, 9999. The definition of CS_DATE is:
typedef CS_INT CS_DATE; /* 4-byte date type*/
CS_TIME corresponds to the Adaptive Server time datatype. The range of legal CS_TIME values is from 12:00:00.000 to 11:59:59:999 with a precision of 1/300th of a second (3.33 ms.). The definition of CS_TIME is:
typedef CS_INT CS_TIME; /* 4-byte time type*/
CS_DATETIME corresponds to the Adaptive Server datetime datatype. The range of legal CS_DATETIME values is from January 1, 1753 to December 31, 9999, with a precision of 1/300th of a second (3.33 ms.). The definition of CS_DATETIME is:
typedef struct _cs_datetime
{
CS_INT dtdays;
CS_INT dttime;
} CS_DATETIME;
where:
dtdays is the number of days since 1/1/1900.
dttime is the number of 300ths of a second since midnight.
CS_DATETIME4 corresponds to the Adaptive Server smalldatetime datatype. The range of legal CS_DATETIME4 values is from January 1, 1900 to June 6, 2079, with a precision of 1 minute. The definition of CS_DATETIME is:
typedef struct _cs_datetime4
{
CS_USHORT days;
CS_USHORT minutes;
} CS_DATETIME4;
where:
days is the number of days since 1/1/1900.
minutes is the number of minutes since midnight.