I need complete working source code for Visual Basic 6 that allows you to pass in a text value and determine if the text value represents a valid date value.
Empty values are always VALID. In other words, it is okay to leave the date BLANK. But if you DO enter a value...it must be VALID.
Date values can be 6 characters long or 8 characters long ONLY.
Format will be MMDDYY or MMDDYYYY
//some_boolean_var = DateIsValid date_as_string
These calls would return TRUE
DateIsValid "" (empty string, no spaces)
DateIsValid "022912"
DateIsValid "02292012"
These would return FALSE
DateIsValid "-"
DateIsValid "&"
DateIsValid "&-"
DateIsValid " " (one space)
DateIsValid " " (two (or more) spaces)
DateIsValid " 022912" (space (or some other char) before the otherwise valid date - even though removing the space would make the date valid - the space means this date fails)
DateIsValid "022912 " (space (or some other char) after the otherwise valid date)
DateIsValid "024912" (there is no 49th of February)
DateIsValid "022911" (2011 was not a leap year)