I am getting ‘time played’ values which come as an integer in the amount of seconds.
Providing there is less than 60 seconds to be added, it’s ofcourse easily done.
However, a lot of the values are more than 59 seconds and therefore cannot easily be converted into a DateTime.
An example of a value would be: 159, which means that the ‘time played’ is 2 minutes and 39 seconds.
Thanks in advance.
A “number of seconds” shouldn’t be stored in a
DateTimein the first place. You should useTimeSpan, which makes it easy:You can add a duration of time to any
DateTime, of course, but that’s a different matter.(You might also want to look into my Noda Time library if you’re doing any significant amount of work with dates and times… the BCL provision is somewhat underwhelming.)