views:

111

answers:

1

I am storing results of a bikerace (think Tour de France) - and the results of the individual stages.

Rider - Stage - Time
Klaus - 1 - 4:12:01 (4 hours, 12 minutes and 1 second)
Klaus - 2 - 1:22:12
Klaus - 3 - 0:12:54
Klaus - 4 - 2:59:05

What datatype should I use to store the time value?

I looked into the TIME datatype, but it does not allow SUM, so that would result in a lot of workarounds for something, that is pretty simple by nature.

Should I reduce to seconds (or milliseconds for that matter) - and the parse the value to a displayable format later?

Or is there another golden option, that I am missing?

+2  A: 

I generally store time as ticks and use the bigint in sql to store it.

Easy to convert to a TimeSpan whenever you need it with:

var timeSpan = new TimeSpan(ticks);
Andrew Barrett

related questions