Hi I was wondering if there could be any issues with
this function I wrote, to determine whether a String is
a Time:
Public Function IsTime(sCheckTime As String) As Boolean
'
' Return true if the String passed to the
' function is a time (like 13:45 or 9:00 PM)
'
If DatePart("h", CDate(sCheckTime)) = 0 And _
DatePart("n", CDate(sCheckTime)) = 0 And _
DatePart("s", CDate(sCheckTime)) = 0 Then
IsTime = False
Else
IsTime = True
End If
End Function
It seems to work fine, but I want to make sure... if
there's a problems with it or you know a better way please tell me.
Thanks
BTW sCheckTime will always be convertible into a valid CDate,
so really the question should be "whether a CDate is a time"
this function I wrote, to determine whether a String is
a Time:
Public Function IsTime(sCheckTime As String) As Boolean
'
' Return true if the String passed to the
' function is a time (like 13:45 or 9:00 PM)
'
If DatePart("h", CDate(sCheckTime)) = 0 And _
DatePart("n", CDate(sCheckTime)) = 0 And _
DatePart("s", CDate(sCheckTime)) = 0 Then
IsTime = False
Else
IsTime = True
End If
End Function
It seems to work fine, but I want to make sure... if
there's a problems with it or you know a better way please tell me.
Thanks
BTW sCheckTime will always be convertible into a valid CDate,
so really the question should be "whether a CDate is a time"