What is the best way to convert seconds into (Hour:Minutes:Seconds:Milliseconds) time?
Let's say I have 80 seconds, are there any specialized classes/techniques in .NET that would allow me to convert those 80 seconds into (00h:00m:00s:00ms) format like to DateTime or something?
Best Answer
For .Net <= 4.0 Use the TimeSpan class.
(As noted by Inder Kumar Rathore) For .NET > 4.0 you can use
(From Nick Molyneux) Ensure that seconds is less than
TimeSpan.MaxValue.TotalSeconds
to avoid an exception.