I have a while loop that will be continually processing information over the weekend. On Monday at 8:00 am I would like this process to stop.
I have this running inside my while loop:
DateTime currentDate = DateTime.Now;
if (currentDate .DayOfWeek == DayOfWeek.Monday)
{
runLoop = false;
}
This should correctly stop my loop as soon as it turns to Monday right?
How do I enable it to continue until 8:00 am on Monday morning?
It sounds to me like it's as simple as:
DateTime currentDate = DateTime.Now;
if (currentDate.DayOfWeek == DayOfWeek.Monday && currentDate.Hour >= 8)
{
runLoop = false;
}
See more on this question at Stackoverflow