![]() |
|
The dttoasc() function converts the field values of a datetime variable to an ASCII string that conforms to ANSI SQL standards.
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 |
A datetime value with the year to fraction(5) qualifier produces the maximum length of output. The string equivalent contains 19 digits, 6 delimiters, and the null terminator, for a total of 26 bytes:
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.