I need to compare that the current time is within a specific range. I've tried the following
DateTime currentTime = DateTime.Now;
int Comaprestart = DateTime.Compare(currentTime, startTime);
int CompareEnd = DateTime.Compare(currentTime,endTime);
if ((Comaprestart >= 0) && (CompareEnd <= 0))
LinkBtnQuiz.Enabled = true;
It doesn't work right. for example I have the end time equal '2014-06-08 13:30:00.000' and the current time equal '2014-06-08 13:12:00.000' but I get CompareEnd=1 while it should be -1 as the current time is earlier than the end time.
Any idea of what is causing the error??