The dttoasc() function
The dttoasc() function converts the field values of a datetime variable to an ASCII string that conforms to ANSI SQL standards.
Syntax
mint dttoasc(dtvalue, outbuf)
dtime_t *dtvalue;
char *outbuf;
- dtvalue
- A pointer to an initialized datetime variable.
- outbuf
- A pointer to a buffer to receive the ANSI-standard DATETIME string for the value in dtvalue.
Usage
The dttoasc() function converts the digits of the fields in the datetime variable to their character equivalents and copies them to the outbuf character string with delimiters (hyphen, space, colon, or period) between them. You must initialize the datetime variable in dtvalue with the qualifier that you want the character string to have.
The character string does not include the qualifier or the parentheses that SQL statements use to delimit a DATETIME literal. The outbuf string conforms to ANSI SQL standards. It includes one character for each delimiter, plus the fields, which are of the following sizes.
- Field
- Field size
- Year
- Four digits
- Fraction of DATETIME
- As specified by precision
- All other fields
- Two digits
YYYY-MM-DD HH:MM:SS.FFFFF
If you do not initialize the qualifier of the datetime variable, the dttoasc() function returns an unpredictable value, but this value does not exceed 26 bytes.
Return values
- 0
- The conversion was successful.
- <0
- The conversion failed.