ISDATE

ISDATE(expression)

Returns the value True or False depending if the expression is a date (Boolean).


expressionThe expression to test (Variant).

REMARKS
* This function refers to your local settings when determining what format is recognised as a date.
* The "expression" can be a date or a string in a date format.
* This function does recognise date and time literals.
* This function is used a lot to test if a text string can be converted to a date.
* You can use the CSTR function to return an expression converted to a String data type.
* You can use the DATE function to return the current system date.
* You can use the ISARRAY function to return True or False depending if the value is an array.
* You can use the ISEMPTY function to return True or False depending if the variable has been initialised.
* You can use the ISERROR function to return True or False depending if the value is an error.
* You can use the ISMISSING function to return True or False depending if an optional argument has been passed in.
* You can use the ISNULL function to return True or False depending if the value contains no data.
* You can use the ISNUMERIC function to return True or False depending if the value is a number.
* You can use the ISOBJECT function to return True or False depending if the variable represents an object.
* The equivalent .NET function is [[Microsoft.VisualBasic.Information.IsDate]]
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print IsDate("01/07/2024")   '= True  
Debug.Print IsDate("01/99") '= True
Debug.Print IsDate("01/13/2024") '= True
Debug.Print IsDate("13/01/2024") '= True
Debug.Print IsDate("12-01-2024") '= True
Debug.Print IsDate(CDate(40544)) '= True
Debug.Print IsDate(40544) '= False
Debug.Print IsDate("1") '= False
Debug.Print IsDate(12) '= False
Debug.Print IsDate("12") '= False
Debug.Print IsDate("text") '= False

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top