Using .NET 3.5
I want to determine if the current time falls in a time range.
So far I have the currentime:
DateTime currentTime = new DateTime();
currentTime.TimeOfDay;
I'm blanking out on how to get the time range converted and compared. Would this work?
if (Convert.ToDateTime("11:59") <= currentTime.TimeOfDay
&& Convert.ToDateTime("13:01") >= currentTime.TimeOfDay)
{
//match found
}
UPDATE1: Thanks everyone for your suggestions. I wasn't familiar with the TimeSpan function.