Determine if a Value is a Valid Time
Category:
Dates and MathType:
SnippetsDifficulty:
BeginningAuthor:
Jim Pragit and Rick RothsteinVersion Compatibility:
More information:
This is one of two examples on the site that checks a value to determine if it is a valid time, the other is at http://www.freevbcode.com/ShowCode.Asp?ID=1321. The two versions differ in the following ways:
- The other version relies on the IsDate function. Therefore, it will accept a value such as "13:33 PM" as a valid time. This version is more stringent and would reject "13:33 PM" as valid (though it would accept "1:33 PM").
- Because the other version relies on the IsDate function, it takes into account international settings, whereas this version is designed as a stringent check of values on systems in which time values conform to the default American English Regional settings.
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations: