i want to check whether a variable contains date or not
public static bool IsDate(string stringToTest)
{
System.DateTime datTest = System.DateTime.Now;
bool bRtn = false;
try {
datTest = System.Convert.ToDateTime(stringToTest.ToString());
bRtn = true;
}
catch(Exception exe) { bRtn = false ; }
return bRtn;
}
if I pass 4.42 to IsDate() then exception occurs and it is returning false (that is what expected)
but if I pass 5.09 to IsDate() then it is returning true (internally 5.09 getting converted to 5/9/2004)
does anybody know how to solve this problem?
I thought that converting value to Double might help
please help me out of this..........
for your information
I am new to c#
I know VB.net well
thanx in advance
mp417