Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating a date
Message
From
15/09/2005 19:31:51
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01050107
Message ID:
01050120
Views:
11
Did you consider the try command?

>How to I validate a date?
>
>The user might enter '5/20', from which I create a string of '05/20/05'.
>
>I then convert it to date using:
>
>
>DateTime dDate = Convert.ToDateTime(sDate);
>
>
>But if the user enter2 '55/75', my string would then be '55/75/05' and
>the conversion to date errors.
>
>I want to validate it before I try to convert.
>
>I'm using C#.
>
>Thanks
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform