Open Server supports two datetime types, CS_DATETIME and CS_DATETIME4. These datatypes are intended to hold 8-byte and 4-byte datetime values, respectively.
In addition, Open Server supports CS_DATE and CS_TIME datatypes. These datatypes behave like CS_DATETIME and CS_DATETIME4, but rather than store data in a single datetime value, they store data in separate 4-byte fixed-width date or time values.
An Open Server application can use the CS-Library routine cs_dt_crack to extract date parts (year, month, day, and so on) from a datetime structure.
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 milliseconds):
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:
typedef struct _cs_datetime4
{
unsigned short days;
unsigned short minutes;
} CS_DATETIME4;
where:
days is the number of days since 1/1/1900.
minutes is the number of minutes since midnight.
CS_DATE corresponds to the Adaptive Server date datatype. The range of legal CS_DATE values is from January 1, 1753 to December 31, 9999.
typedef struct _cs_date
{
CS_INT days;
} CS_DATE;
where days is the number of days since 1/1/1900
CS_TIME corresponds to the Adaptive Server time datatype. The range of legal CS_TIME values is with a precision of 1/300th of a second (3.33 milliseconds):
typedef struct _cs_time
{
CS_INT time;
} CS_TIME;
where time is the number of 300ths of a second since midnight.