DateValue

Convert a string to a date.

Syntax
      DateValue (expression)

The expression must be a valid date. The Date data type accepts either the date or the time, or both. Possible values range from January 1, 100 to December 31, 9999.

The interpretation of two-digit years will vary according to the versions of Windows. To be sure the function returns the proper value, use a four-digit year.

The DateSerial() function may be used in VBA or in an SQL query.

Example

Dim dtmRetirement as Date

dtmRetirement = DateValue("Aug 6, 2083")
dtmRetirement = DateValue("12/30/2012")
dtmRetirement = DateValue("December 30, 2012")

“If you are planning for a year, sow rice; if you are planning for a decade, plant trees; if you are planning for a lifetime, educate people” ~ Chinese Proverb

Related:

CDate - Convert an expression to a Date
DateSerial - Return a date given a year, month, and day.
Standard date and time notation - YYYY-MM-DD


© Copyright SS64.com 1999-2013
Some rights reserved