|
-
Aug 28th, 2007, 08:06 AM
#1
Thread Starter
New Member
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?
-
Aug 28th, 2007, 08:08 AM
#2
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.
-
Aug 28th, 2007, 10:38 AM
#3
Re: Counting file sizes and lenghts together
Last edited by JuggaloBrotha; Jun 30th, 2010 at 03:00 PM.
-
Aug 29th, 2007, 09:06 AM
#4
Thread Starter
New Member
Re: Counting file sizes and lenghts together
Thank you both for your answers. Now, if only someone could help me with formatting System.Time...
-
Aug 29th, 2007, 09:14 AM
#5
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.
-
Aug 30th, 2007, 08:30 AM
#6
Thread Starter
New Member
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...)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|