Counting file sizes and lenghts together
Hi, I have couple questions for you... Be gentle, I'm a beginner :)
1. If I know a file's size in bytes, how can I convert it to decimal that shows it in megabytes with 3 or more digits? As in, 0,00 MB?
2. How can I count many files together in format like 0,00 MB?
3. If I know an mp3 file's lenght in seconds and milliseconds (stored in System.Time variable), how can I display it like 00:00:00 (hh:mm:ss)?
5. How can I count file lenghts together like using format 00:00:00?
Re: Counting file sizes and lenghts together
1 KB = 1024 B
1 MB = 1024 KB
and so on ... bt I'm sure you know how to divide and format numbers.
Re: Counting file sizes and lenghts together
Re: Counting file sizes and lenghts together
Thank you both for your answers. Now, if only someone could help me with formatting System.Time... ;)
Re: Counting file sizes and lenghts together
The play time of your mp3 file is a duration of time, so you would use the TimeSpan class. Once you get the play time as a timespan object, you can do calculations and call its ToString method to display it.
Re: Counting file sizes and lenghts together
Thank you stanav for your answer, it didn't quite explain it to me but I was on the right track by your answer. Actually, this is what I was after:
Format (System.TimeSpan.Hours.ToString, "00")
(In case someone else needs to know this stuff...)