I have a small file that compares the time and runs a routine based on the result.
DateTime now = DateTime.Now; //get the current time
//The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
DateTime start = new DateTime(now.Year, now.Month, now.Day, 00, 00, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 17, 25, 00);
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
//routine runs here
}
I'd like it to also run the same routine between the following time frame
DateTime now = DateTime.Now; //get the current time
//The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
DateTime start1 = new DateTime(now.Year, now.Month, now.Day, 23, 59, 00);
DateTime end1 = new DateTime(now.Year, now.Month, now.Day, 22, 00, 00);
while (now.CompareTo(start1) >= 0 && now.CompareTo(end1) <= 0)
{
//routine runs here
}
How would I merge the (now.CompareTo(start) and (start1) as well as (end) and (end1)