Question Adding Hours, Minutes, and seconds

Last2Try

New member
Joined
Apr 17, 2015
Messages
3
Programming Experience
Beginner
Hello, I have a directory of MP3's that I load to a listbox, I know how to get the duration of each MP3 as its loaded to the list box using UltraID3lib.dll I cant figure out how to get total play time of all MP3s. UltraID3lib.dll displays duration as 00:03:35.

Thanks or any help....
 
Use TimeSpan structure, its Parse method can read the time from string. You can add together two TimeSpans with + operator.
 
Actually on second thought I find it strange that UltraID3lib wouldn't provide duration as a TimeSpan, and in fact it does, its Duration property is type TimeSpan. That saves you parsing strings.
 
Back
Top