MS Access DateValue() Function

The DateValue() function in MS Access converts a text string representing a date into an actual date value that MS Access can use in calculations, comparisons, or formatting. This is very useful for handling date data stored as text.



DateValue(): Definition and Usage

DateValue() is particularly helpful when you are working with date data that is stored as text (for example, from an import) and you need to convert it into a format suitable for date-related operations within your MS Access applications. If the string doesn't include a year, the current year is used. The input string should be in a format that MS Access recognizes.

Syntax

Syntax

DateValue(string_date)
      

Parameter Values

Parameter Description
string_date A string representing a date (from January 1, 100 to December 31, 9999). This is required.

Examples

Converting a Date String with Year

This converts the string "May 17, 2017" to a date value.

Syntax

SELECT DateValue("May 17, 2017");
      
Output

2017-05-17 (or similar date format based on your regional settings)
      

Converting a Date String Without Year

If the year is omitted, the current year will be used.

Syntax

SELECT DateValue("May 17");
      
Output

(Current year)-05-17 (or similar date format based on your regional settings)