Notifications
Clear all
V2 How do I...?
12
Posts
6
Users
0
Reactions
4,590
Views
Dec 13, 2009 11:51 pm
ElectricCraft1 wrote:One question is if there are multiple start / end definitions, ie: start0, start1, etc.; how do these get defined prior to the loop. I too have had problems with the not starting and this seems to be my answer.
I think this is what you are looking for
DateTime now = DateTime.Now; //get the current time
DateTime start1 = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end1 = new DateTime(now.Year, now.Month, now.Day, 22, 00, 00);
DateTime start2 = new DateTime(now.Year, now.Month, now.Day, 22, 30, 00);
DateTime end2 = new DateTime(now.Year, now.Month, now.Day, 23, 30, 00);
while ((now.CompareTo(start1) >= 0 && now.CompareTo(end1) <= 0) || (now.CompareTo(start2) >= 0 && now.CompareTo(end2) <= 0))
{
// Inner Loop
}
}
Dec 14, 2009 11:28 am
Thanks for the help. See tonight if it works.
Page 3 / 3
Prev
