Developer Documentation Library > UNICOM Intelligence Function Library > Conversion functions > CDate
 
CDate
Converts a value of any data type to a Date value.
Syntax
CDate(<value>)
Parameters
<value>
Type: None
Variant value to be converted.
(return)
Type: Date
Date value derived from <value>.
Notes
The converted dates are held in Microsoft variant date standard format. Converting other data types to a date is likely to give meaningless results.
The result of the conversion depends on the data type of <value>, as follows:
Boolean: The return value is likely to be meaningless.
Categorical: An error occurs.
Date: <value> is returned unchanged.
Double: The return value is the date and time resulting from using <value> as the internal representation of the date.
Long: The day is <value> days after 30 December 1899 (or before, if <value> is negative) and the time is 00:00:00.
Object: If the object has a default property, the value of that property is converted. Otherwise an error occurs.
Text: The string is parsed according to the locale to extract the value. An error occurs if the string does not contain a properly formatted date.
NULL values
If <value> is NULL, the return value is 30 December 1899 00:00:00.
This function is similar to CDate in Visual Basic.
Examples
Data type
Value
Result
Long
37430
6/23/2002
Double
37429.56
6/22/2002 1:26:24 PM
Text
14 April 2001 20:30:02
4/14/2001 8:30:02 PM
Text
Fossils
Error
Categorical
{5,3,1,9}
Error
See also
CBoolean
Conversion functions