c# - Get average time from dataGridView -
i have datagridview populated sql statement. placed in tabcontrol , in tabcontrol, have different textboxes give insight figures.
anyway, lastly column filled duration times in format:
00:03:00
what need calculate average of times. have found calculate average of regular integers , such not time.
any help appreciated.
you can parse values timespan
, convert them milliseconds (or ticks), compute average (from "regular integers"), convert average timespan
.
say have values in array of strings called durations
, here's can it:
var averageticks = durations.select(d => timespan.parse(d).ticks).average(); var averageduration = timespan.fromticks(averageticks);
hope helps :)
c# time average
No comments:
Post a Comment