Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Valid date check with DateTime.TryParse method

DateTime fromDateValue;
string s = "15/07/2012";
var formats = new[] { "dd/MM/yyyy", "yyyy-MM-dd" };
if (DateTime.TryParseExact(s, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out fromDateValue))
{
    // do for valid date
}
else
{
    // do for invalid date
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Valid #date #check #method
ADD COMMENT
Topic
Name
5+1 =