There are many places where we need to validate whether the given string is a valid Date or not. The following simple method handy for the same...
private bool IsDate(string strDate)
{
DateTime dt;
bool boolIsDate = true;
try
{
dt = DateTime.Parse(strDate);
}
catch
{
boolIsDate = false;
}
return boolIsDate;
}
4Z ~ Fauzi
No comments:
Post a Comment