I've run across this problem and I want to see if anyone else has as well.
It appears as though the IsDate function works as a IsTime function as well. During my testing, however, I have discovered a major problem with this.
I enter "10:50" in my text box. This is a valid time, but an invalid date. This has the effect of, when I reformat the entered date, of giving me a date/time of "December 30, 1899 10:50:00." 12/30/1899 is the default date if none is given in the Date/time datatype.
Here's a code snippet:
Has anyone encountered this problem before? Is there a VB function to *just* check if a string is a valid date?Code:If IsDate(sText) Then WorkDate = CDate(sText) txtTextBox.Text = Format (WorkDate, "mm/dd/yyyy hh:mm:ss") Else MsgBox "Not a valid date" End If
Thanks,
trapper




Reply With Quote