You are correct that the CompareValidator does not support Date + Time. You
will have to write a custom validator or consider an alternative design.
With a CustomValidator, on the server side you can use the DateTime
structure's ParseExact() method. If it throws an exception, it indicates a
bad entry.
May I suggest an alternative design? By combining both date and time into
one textbox, you are asking for the user to be very careful with formatting.
Users have to know both date and time patterns that you are expecting, plus
any separator rule. Often you assist users in entering dates with a popup
calendar. Time might have similar tools. If you allowed separate date and
time fields, you not only can add a popup calendar, but its also easier to
install client-side keystroke filtering to avoid illegal character entry.
Finally, these separate fields are easier to validate. You know that
CompareValidator can handle a date. You still would have to build a
validator for time.
My "Peter's Date Package" is a solution that includes datetextbox with popup
calendar, timeofdaytextbox, and validators for both. The two fields can
interact together. You can get and set one DateTime value and the software
interacts with both.
http://www.peterblum.com/datecontrols/home.aspx.
--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx