Date of Birth textbox1(calendar image)
i want to validate date of birth date should be greater than the todays date and more than the todays date.
for that i write the code as follows;
DateTime DOB = Convert.ToDateTime(FromDate.ToString());
if(FromDate.SelectedDateValue > DateTime.Now)
{
Label6.Text = ("you have not born yet");
}
i try the above code when i run i show the error message as follows;
Operator '>' cannot be applied to operands of type 'string' and 'System.DateTime.
for my above code please correct my code and reply.
thanks,please help me.
Sivaraman DhamodaranPosted Dec 26, 2012, 5:48 AM
Try to compare two date or string form of date.
if (DOB > DateTime.Now).
See you already did the conversion as DOB is DateTime type