![]() |
|
The dtcvasc() function converts a string that conforms to ANSI SQL standard for a DATETIME value to a datetime value. For information about the ANSI SQL DATETIME standard, see page 6-15.
You must initialize the datetime variable in dtvalue with the qualifier that you want this variable to have.
The character string in inbuf must have values that conform to the year to second qualifier in the ANSI SQL format. The inbuf string can have leading and trailing spaces. However, from the first significant digit to the last, inbuf can only contain characters that are digits and delimiters that conform to the ANSI SQL standard for DATETIME values.
If you specify a year value as one or two digits, the dtcvasc() function assumes that the year is in the present century. You can set the DBCENTURY environment variable to determine which century dtcvasc() uses when you omit a century from the date.
If the character string is an empty string, the dtcvasc() function sets to null the value to which dtvalue points. If the character string is acceptable, the function sets the value in the datetime variable and returns zero. Otherwise, the function leaves the variable unchanged and returns a negative error code.
The demo directory contains this sample program in the dtcvasc.ec file.