You would want to use Regular Expressions. The exact expression depends on what format you are enforcing, ie yyyy-mm-dd, m/d/yy, and so on. I usually use
http://regexlib.com/[
^] as my resource, but a Google search for "regex date validation" will turn up lots of options.