Home Privacy Policy Feedback Link to us Site Map

Access: CDate Function


Question:  How do I convert a value to a date?


Answer:  To convert a value to a date, use the "CDate" function. The syntax for the CDate function is:

CDate( expression )

For example:

Dim LstrDate As String
Dim LDate As Date

LstrDate = "Apr 6, 2003"
LDate = CDate(LstrDate)

The function called "CDate" will convert any value to a date as long as the expression is a valid date.

In this example, the variable LDate would now contain the value 4/6/2003.