To verify that the user is at least 13 years old, I need a MVC2 web application, whether a date / Date time validation feature that enables me to do this?
Since you are not actually validating a date, you have an equation (today - Date> 13), you have to type something like this (this is just a back-of-the-napkin example).
Using the system. ComportModel.Data Annotation; Public category age legality attribute: Validation Account {Public Int Minage {Receipt; Set; } Public Override Bull ISIELD (Datetime Value) {If (value == empty) {Return true; } Return Date Time.Now Subtract (value). Total days & gt; (Minnej * 365.25); }}
Comments
Post a Comment