DateValue

This function removes the time information from a specified date, leaving only the month, day, and year.

Syntax

DateValue(date)

Parameters

date
Usually a string expression representing a date from January 1, 100 through December 31, 9999. However, date also can be any expression that can represent a date, a time, or both a date and time, in that range.

Return Values

Returns a Variant of subtype Date.

Remarks

DateValue returns 0 (12:00 AM) if date includes only time information. A type mismatch error occurs if date includes invalid date or time information, such as 89:98.

If date is a string that includes only numbers separated by valid date separators, DateValue recognizes the order for month, day, and year according to the short date format you specified for your system. DateValue also recognizes unambiguous dates that contain month names, either in long or abbreviated form. For example, in addition to recognizing 12/30/1991 and 12/30/91, DateValue also recognizes December 30, 1991 and Dec 30, 1991.

If the year part of date is omitted, DateValue uses the current year from the system date of your computer.