SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Sep 30, 2008, 05:04 #1
- Join Date
- Sep 2007
- Posts
- 41
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
converting milliseconds to hours and minutes
I have 2 Date objects and count down from now to ready,
and show it in the format of "00 HOURS and 00 MINS."
Code:var now:Date = new Date(); var ready:Date = new Date(2008,9,10,12,0,0); var dif:Number = (ready.valueOf() - now.valueOf()); trace(dif);
Please help.
P.S. I`m using A.S. 3.0
-
Sep 30, 2008, 11:39 #2
if the variable value contains the time in miliseconds then
Code:var hr:Number = Math.floor(value / 3600000); var min:Number = Math.floor((value % 3600000) / 60000);
1 hr = 3600 s = (3600 * 1000) ms = 3600000 ms
1 min = 60 s = (60 * 1000) ms = 60000 ms
Bookmarks