Solved

millisecond countdown timer

Posted on 2012-04-11
3
1,603 Views
Last Modified: 2012-04-25
I'm trying to create a timer that counts down in years, months, days, hours, minutes, seconds and milliseconds. I've found a few guides online, but they are sort of not easy to understand, or do not do the milliseconds. Can anyone help me do something like this, say, for this friday at 13:30.

so it could read 0y 0m 2d 2h 11m 50ms

and counts down the milliseconds. I would show code to demonstrate that I have actually tried to do this myself, but it all failed so dismally that i'd be embarrassed to.

Thanks for any help!
0
Comment
Question by:hibbsusan
  • 2
3 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37834333
download the sample code from here and make the changes to include year, month and milliseconds....

http://www.hashemian.com/tools/javascript-countdown.htm
0
 

Author Comment

by:hibbsusan
ID: 37834496
Right. I couldn't figure out how to make this one display milliseconds -

Thanks!
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37834577
First Download this js file:-
http://scripts.hashemian.com/js/countdown.js

Next modify the DisplayFormat variable as:-
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds, %%MS%% MilliSeconds.";

Next in coutback method add this line for milliseconds:-
DisplayStr = DisplayStr.replace(/%%MS%%/g, calcage(secs*1000,1,1000));

i hope you will make rest of the changes now...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question