Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to validate a date in C#?
Message
From
06/09/2006 11:53:53
John Baird
Coatesville, Pennsylvania, United States
 
 
To
06/09/2006 11:41:54
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01151376
Message ID:
01151382
Views:
25
I use the DateTime.TryParse() or DateTime.TryParseExact() depending on my situation. The function returns a boolean and if the datestring is recognized as a valid date, it returns the date in an "OUT" parameter.


>Simple question:
>
>I have an ASP.NET app where the user will enter a date range for a report.
>There are two textboxes for date from and to.
>
>I get the dates as text. I am adding a custom validator.
>What's the best/easiest way to test entered dates are valid? (C# 2.0)
Previous
Reply
Map
View

Click here to load this message in the networking platform