CTOD()
Convert a date string to a date value.
Syntax
CTOD(<cDate>) --> dDate
Arguments
<cDate> --> is a character string consisting of numbers representing the day, month and year separated by slash (/) characters. If the century digits are not specified, the century is 20th if the year digits are between 50 and 99. The century is assumed 21st otherwise.
Returns
CTOD() returns a date value. If <cDate> is not a valid date, CTOD() returns an empty date.
Description
CTOD() is a character conversion function that converts a character string to a date variable. To initialize an empty date for date entry, specify <cDate> as a null string (""), SPACE(8), or " / / ".
CTOD() is used whenever you need a date value. Such as when:
Initializing a variable to a date value.
Specifying a date string in order to perform date arithmetic.
Comparing the result of a date expression to a date string.
CTOD() is the inverse of DTOC() which converts a date value to a character string. DTOS() also converts a date value to a character string in the form of yyyymmdd. (Which is useful when you need to sort by date values.) A more flexible version of CTOD() is ForDate().
Examples
dDate := CTOD('01-01-2001')
____________________________
Related Topics: