Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!
Public Function IsValidTime(ByVal TheTime As String) As Boolean ' Format 1 validates the time against the 12 hour format Dim Format1 As String = "^ *(1[0-2]|[1-9]):[0-5][0-9] *(a|p|A|P)(m|M) *$" Dim TryValidateFormat1 As New System.Text.RegularExpressions.Regex(Format1) ' Format 2 validates the 24 hour format Dim Format2 As String = "([0-1][0-9]|2[0-3]):([0-5][0-9])" Dim TryValidateFormat2 As New System.Text.RegularExpressions.Regex(Format2) Return TryValidateFormat1.IsMatch(TheTime) Or TryValidateFormat2.IsMatch(TheTime) End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.