Validating date in asp net c
But how to told Range Validator, that date is in format "dd/MM/yyyy" ? I would like to have total secure validation method in client site..
Thanks for help Firstly, your date format is ambiguous. in that format, tomorrow's date would appear as 12/11/2008.
Just the thought that I have to convert that from mm-dd-yyyy to dd-mm-yyyy makes my head hurt...
I used Regular Expression Validator with Validation Expression="[0-3][0-9]/[0-1][0-9]/[1-2][0-9][0-9][0-9]", but user can write date "31/02/2000" and validator says that it is correct (everybody know that Febuary has 28 or 29 days).
You will also want to replicate that code in C# on the server side, to cover the case where the user bypasses validation on the client side. Try Parse() if its a good date returns true example below string s Date ="02/29/2007"; Date Time Date Value; Console. But how to told Range Validator, that date is in format "dd/MM/yyyy" ? I would like to have total secure validation method in client site..
I was thinking of using Range Validator with Type="Date".I need to validate a date entered in a textfield (but is a Date Time anyway) and display the error to the user if there's some problem, like an invalid date (p.e. If I do insert an invalid date, I get a as expected, but I don't want to display this message to the user. Is there a way to catch this exception and change the display text? .3) # and day not Feb 30 or 31 ) #end Leap year check ) #end of month check (? If you made it this far the number of day is within the range for the given month) \k(? :42|3|2|1|09)\x20BC)) )| # else if not Feb 29 (?! # The maximum number of days allowed for a month has already been checked for in the month check.