var startTime = new DateTime(2010, 10, 1, 9, 0, 0);
var endTime = new DateTime(2010, 10, 1, 16, 0, 0);
var interval = 11;
So given a start time of 9am, an end time of 4pm and an interval of 11 how can I find out how many time slots there are between the start and end times?
Does that make sense? I know the answer will be 43 time slots, but how to derive it?
Yes, sorry, it was a typo. I copied what he gave me and forgot to change the 11 interval to a 10. As he wants 10min intervals as he states above with his example.
Another thing you can do, which I have done in the past is the following:
var startTime = new DateTime(2010, 10, 1, 9, 0, 0);
var endTime = new DateTime(2010, 10, 1, 16, 0, 0);
var interval = 11;
while (startTime <= endTime)
{
Response.Write(startTime.ToString("HH:mm")); //OR HOWEVER YOU WANT TO DISPLAY IT
startTime.AddMinutes(interval);
}