Home Privacy Policy Feedback Link to us Site Map Forums

Access: DateValue Function


In Access, the DateValue function converts a string to a date.

The syntax for the DateValue function is:

DateValue ( string_date )

string_date is a string representation of a date. string_date can be a date ranging from January 1, 100 to December 31, 9999. It can include a time component, if desired.


Note:

If string_date includes numbers separated by slashes (or other date separators), then the DateValue function will use your Window's Short Date format to determine the order of the year, month, and day components.

If string_date does not include the year component of the date, the DateValue function will use the current year.


For example:

DateValue ("June 30, 2004") would return 6/30/2004
DateValue ("6/30/2004") would return 6/30/2004
DateValue ("June 30") would return 6/30/2004

VBA Code

The DateValue function can be used in VBA code. For example:

Dim LDate As Date

LDate = DateValue ("May 15, 2003")

In this example, the variable called LDate would now contain the value of 5/15/2003.


SQL/Queries

You can also use the DateValue function in a query.