DateValue function

Category: Date & Time

Summary

String to date.

Syntax

Returns a Variant (Date).

Example

Example
This example uses the DateValue function to convert a string to a date. You can also use date literals to directly assign a date to a Variant or Date variable, for example, MyDate = #2/12/69#.
Dim MyDate
MyDate = DateValue("February 12, 1969") ' Return a date.

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/datevalue-function

Back to Functions