I have a number of records with various DateTimes, but I need to track these in a graphical layout. I currently have managed to retrieve the timespan of each record
List<myclass> recs = context.myclass.Where(c => c.RequestedTimestamp >= start & c.DeliveredTimestamp <= end).ToList();
foreach (var item in recs)
{
TimeSpan diff = (TimeSpan)(item.DeliveredTimestamp - item.RequestedTimestamp);
//more to come, this is where I realized I have issues
}
This of course, will return me a list of timespans, but that in itself is not very helpful.
How would this be better approached in order to achieve a list of weekly (or monthly) average of these timespans.
The problem I consider is that timespans forget their start and end points, therefore whilst these can be averaged, how is the averaging going to be performed in a grouped approach?
The output; an average timespan for a group of DateTimes, is to be hooked into a chart for a visual display.