if (ts1.CompareTo(DateTime.Now) == -1 && ts2.CompareTo(DateTime.Now) == -1)

the function asks for a object, i gave an object...

Because it's not a TimeSpan. Use DateTime.Now.TimeOfDay. That is if ts1 is of type TimeSpan.

Works with me if ts1 and ts2 are DateTimes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.