Returns the expression converted to a variant date subtype (Variant).
|expression||The expression to evaluate and convert to a date.|
|* CDATE was added to replace this function.|
* This function is provided for backwards compatibility and should not be used.
* When converting a number to a date, the whole number portion is converted to the date, and any fractional part of the number is converted to the time.
* This function will convert any number of data types and string formats into an actual date.
* You can use the TYPENAME function to return the data type of the variable as a string.
* For more information, refer to the Data Types > Date-Variant page.
Dim vDate As Variant
vDate = CVDate("11/2/21")
Debug.Print VBA.TypeName(vDate) ' Date
Dim dtDate As Date
dtDate = CVDate("November 2, 2020")
Debug.Print VBA.TypeName(dtDate) ' Date
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited Top