CitectVBA Programming Reference > CitectVBA Function Reference > Conversion Functions > CDate


Converts any valid date expression to a Date data type.

The CDate function expects the argument Date to be a date expression (limited to numbers or strings in any combination) that can represent a date from January 1, 100 through December 31, 9999.




A string or expression that can represent a date value. This includes any combination of date literals, numbers that look like dates, strings that look like dates, and dates from functions.

Return Value

Returns the value of the expression Date provided in the argument as a variant with a vartype of 7 (date data type).

Related Functions

CDbl | CInt | CLng | CSng | CStr | CVar


Dim MybDate, MDate, MTime, MSTime
' Define date.
MybDate = "May 29, 1959"
' Convert to Date data type.
MDate = CDate(MybDate)
' Define time.
MTime = "10:32:27 PM"
' Convert to Date data type.
MSTime = CDate(MTime)