Description
IsTime returns True if the given String or Number value can be converted to a valid Time and returns False otherwise.
Arguments
string is a String value or expression to be tested for being convertible to a Time value. Many forms are accepted.
number is a Number value or expression to be tested for being convertible to a Time value. It can be positive, negative or fractional. It is interpreted as units of 24 hours. What this means is that 0 is 12 midnight and 0.5 is 12 noon.
Returns
Boolean value (True or False).
Action
IsTime returns True if the given String or Number value can be converted to a valid Time and returns False otherwise.
Typical use
If you want to convert a String value to a Time using the functions
CTime or
TimeValue, use the IsTime function first to check if the conversion will succeed. See the examples section of
IsDate for an example of this type.
Examples
IsTime ("10:30 pm")
Returns True.
IsTime ("September 30,1999")
Returns True since the given String argument is interpreted as 12:00:00 am.
IsTime (3.2)
Also returns True since the given Number argument is interpreted as 3.2 units of 24 hours, which is 4:48:00am.