Countdown Timer HELP

I got this countdown timer, when a date is passed in, it shows days, hours, minutes, seconds, milliseconds. One problem, is that the hours contain the days converted into hours and any other hours less the 24, minutes contain all the minutes of the days, hours and any other minutes left over etc. (I know hard its to understand). Wondering if anyone out there knew how to stop this (looking for the days, and hours left over, NOT day converted to hours and hours left over less than a day), i think i need to use mod(%), but i dont know where. Here come the code, run it, it works perfectly and you will see what I mean. Code solution would be gravy
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
mDate = new Date("15:54 April 29 2004")
function countdown()
     var now=new Date()
     var diff=mDate.getTime()-now.getTime()
     if (diff <= 0)
          document.bid.mseconds.value = 0
          return 0;
     document.bid.days.value = Math.round(diff/(24*60*60*1000))
     document.bid.hours.value = Math.round(diff/(60*60*1000))
     document.bid.minutes.value = Math.round(diff/(60*1000))
     document.bid.seconds.value = Math.round(diff/1000)
     document.bid.mseconds.value = diff
     var id=setTimeout("countdown()",0)
</SCRIPT>
</HEAD>
<BODY onLoad="countdown()">
Countdown <BR>
<form name="bid" method="post" action="">
<p>Timeleft</p>
<TABLE BORDER=0>
<TD width="79">Days: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
<TD width="79">Hours: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
<TD width="79">Minutes:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
<TD width="79">Seconds: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
<TD width="79">Milliseconds:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
</TABLE>
</form>
</BODY>
</HTML>
Regards,
Don Colvin (Computer Science Student)

and what is your JSP related question ?

Similar Messages

  • Need help on countdown timer!

    Could someone please guide me in the direction as to how to make a countdown timer?  I created a timer that counts down to a certain date, but I just want the timer to countdown 24 hours, not to a certain date.  I also want to have a button below the timer so that when you click it, it adds 30 seconds to the timer.  Can anyone help me with this?

    Hi,
    I hope it will be use full for u....
    var timelong=2000;
    var mytimer:Timer=new Timer(timelong,1);
    mytimer.addEventListener(TimerEvent.TIMER_COMPLETE,myfunc);
    mytimer.start();
    function myfunc(event:TimerEvent)
        trace("hi it's working");
    mybut.addEventListener(MouseEvent.CLICK,addtime);
    function addtime(event:MouseEvent)
        timelong+=3000;
    Thanks,
    K Swamy Vishnubhatla,

  • Countdown timer project help

    I am designing a 30 minutes countdown timer with a LDR in the circuit.
    So far i can`t even achieve a simple countup timer from 0-9 , please help.
    Clock pulse (Astable multivibrator)- 555 timer circuit
    4 bit counter wired as MOD 10 74LS293N
    74LS47N Decoder 
    LED common anode.
    Attachments:
    Simple countup 0-9 counter.ms10 ‏128 KB

    It seems that your 555 timer isn't counting, I hooked up an oscilloscope to it to see what it was generating
    Attachments:
    Simple countup 0-9 counter.ms11 ‏353 KB

  • Help in AS3 code of 24 hour countdown timer

    hello,
    i  just wanna ask if someone can help me,
    i created a 24 hour flash countdown timer here http://allofmyworks.weebly.com/flash.html
    the problem is when it reaches the desired time, the time still counts and became negative,
    what i want is to make it only 24hour countdown clock and when it reaches the time it will only stay in 00:00:00
    thanks
    here is the code i used
    var endDate:Date = new Date(2012,0,4);
    var countdownTimer:Timer = new Timer(1000);
    countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
    countdownTimer.start();
    function updateTime(e:TimerEvent):void
              var now:Date = new Date();
              var timeLeft:Number = endDate.getTime() - now.getTime();
              var seconds:Number = Math.floor(timeLeft / 1000);
              var minutes:Number = Math.floor(seconds / 60);
              var hours:Number = Math.floor(minutes / 60);
              seconds %= 60;
              minutes %= 60;
              var sec:String = seconds.toString();
              var min:String = minutes.toString();
              var hrs:String = hours.toString();
              if (sec.length < 2) {
                        sec = "0" + sec;
              if (min.length < 2) {
                        min = "0" + min;
              if (hrs.length < 2) {
                        hrs = "0" + hrs;
              var time:String = hrs + ":" + min + ":" + sec;
              time_txt.text = time;

    here is the code
    var endDate:Date = new Date(new Date().getTime()+24*60*60*1000);
    var countdownTimer:Timer = new Timer(1000);
    countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
    countdownTimer.start();
    function updateTime(e:TimerEvent):void
              var now:Date = new Date();
              var timeLeft:Number = endDate.getTime() - now.getTime();
              var seconds:Number = Math.floor(timeLeft / 1000);
              var minutes:Number = Math.floor(seconds / 60);
              var hours:Number = Math.floor(minutes / 60);
              seconds %= 60;
              minutes %= 60;
              var sec:String = seconds.toString();
              var min:String = minutes.toString();
              var hrs:String = hours.toString();
              if (sec.length < 2) {
                        sec = "0" + sec;
              if (min.length < 2) {
                        min = "0" + min;
              if (hrs.length < 2) {
                        hrs = "0" + hrs;
              var time:String = hrs + ":" + min + ":" + sec;
              time_txt.text = time;

  • How can I make a countdown timer using After Effects

    I'd like to make a video that has a timer that counts down one second at a time. I need one starting at 5:00 (five minutes). Is there a way to easily do this in After Effects without having to manually change the text every second?
    Thanks.

    I'm glad that you found a solution, but I thought that you might appreciate a suggestion of another approach.
    Colin Braley provides a tutorial and example project on
    his website that show how to use an expression on the Source Text property to animate text to overcome some of the limitations of the Numbers effect.
    There's a similar example in the
    "Example: Animate text as a timecode display" section of After Effects Help.
    Here are some Community Help searches that can lead you to some ideas, too:
    Community Help search for 'countdown timer'
    Community Help search for 'digital countdown timer'

  • Javascript countdown timer not working in Safari

    Years ago I copied a Javascript for a countdown timer and it has been working on my website ever since in both Safari and Firefox. I have been working on updating my site and suddenly it stopped working in Safari, but still works in Firefox. Obviously, I'd like it to work in everyone's browser if possible. I've created a page which only has the countdown timer on it. Can anyone tell me what I need to do to get it to work in Safari?
    The test page where you can see this is: http://hyperflite.com/countdowntest.html
    TIA

    Hi,
    Is there any reason for the numerous body tags in there?
    <pre><body onload="doCountdown();">
    <body>
    <body ... >
    </pre>
    I don't have Safari here to test with, but I wouldn't have thought they were helping matters

  • Countdown timer to NEXT WHOLE HOUR..?

    Hello.
    I need to create a countdown timer function.
    Normally that would not be a problem for me, but this timer needs to countdown to the next whole hour. As an example, if the time is 23:42 the countdown would say 17:35 (17 minutes, 35 seconds).
    When the timer hits zero, it will start from 59:59 and so on.. Always counting to the next whole hour.
    Im kind of in a jam and need this done ASAP, any help would be greatly apreciated!
    / Rasmus

    Im sorry if i implied that im a great actionscripter, im not
    What i would normally do is just grab a counter script from a google search and modify it to countdown to the correct time, but i havent been able to find a counter that counts down to the next whole hour.
    It should just be plain and simple and display the time in minutes and seconds like this: 25:14
    I found this one on google, counting down for christmas. If that could be modded into showing only minutes and seconds and of course counting down to the next whole hour, that would be awsome!
    https://dl.dropbox.com/u/2628604/countdown-test.fla

  • Insert a countdown timer in Keynote?

    Hello all,
    I'm sure this is an included feature that I just can't find somehow. I would like to insert a countdown timer into a slide. This seems pretty common; I've seen it done a lot. But I just can't find the Insert>timer link, or anything like it. And the iWork help file is forever searching and never going anywhere (second, embedded problem), so I can't search there.
    I tried the iPresentee thing, but it didn't download properly. Plus, it seems like a basic feature available for a presenter, especially since there's a timer included in the Presenter view.
    Any help would be appreciated. Thanks.

    d moon,
    Keynote does not provide any countdown timer features. You need to seek third parties for them.
    The iPresentee timers are a good start - their website provides a free "goodie" of timers in the form of a Keynote File where many choices of timers are available. Try downloading the file again or contact iPresentee for assistance.
    Each Timer is actually a Quicktime video clip. You select the one with the closest time range to your needs, copy it to your presentation and adjust the start point.
    Keynote > Inspector > Quicktime > Start & Stop controls

  • Display a countdown time in a message box

    I still search for an easy way to show a 30sec realtime countdown timer in a message box.
    Are there any hints from your side. thanks -

    I think this vi could help, depending on what you mean with "realtime". Sorry for the mixed language messages.
    Paolo
    Paolo
    LV 7.0, 7.1, 8.0.1, 2011
    Attachments:
    CountDown.vi ‏31 KB

  • IOS 6 bug - countdown timer

    I just upgraded my iPhone 4 to iOS 6 and found a strange bug: when setting the system time format to 12-hour time, then open Clock - Timer, if I set the timer's countdown duration longer then 1 hour, after starting, the timer displays the countdown time in a very strange style (see the attached screenshot). But after setting the system time format back to 24-hour time, this timer's dislay problem disappeared. Really weird bug.

    I too have this on my iPhone 4S, I am in the UK, and I like to have the 12 hour setting for my time, but when this is the case I get the same strange problem as QQ as shown,  ALSO... I believe if I run the Stopwatch and it goes over an hour then the display goes strange in the same way.  Apple feel free to contact me, so I can help you resolve this for iOS 6.0.x.
    Thanks
    Daniel

  • Countdown timer in adobe form from a field and pop-up warnings

    I have created a form in adobe livecycle and I would like to add a Countdown timer that clicks off when a user enter's a time. I need the countdown timer to be 2 hours from the entered time. The user will have 2 hours to complete the form. I need warning boxes that will pop up at 30 minutes and at 15 minutes. If not completed in the 2 hour time frame from when the time was entered then the form will prompt to close.
    I have found where the timer starts from the start or stop button but I would like it to start from when the time field is excited.
    I am new to form scripting and any help would be greatly appreciated.
    Thank you

    Do you mean the JavaScript methods setTimeout(), clearTimeout(), setInterval() and clearInterval() ???
    I don't think these methods will work within Adobe LiveCycle forms.
    Nith

  • AS3 - 1) Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place; 2) Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true - ActionScript 3 - flash cs3 cs4

    Hi folks,
    Ronny's here again on forums, having particularly 2 (two) questions/problems to resolve:
    1) Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place
    2) Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true
    attached is the .zip file (as3_Countdown Timer_ver 1.0.1_by Ronny Depp.zip) with all flash source files containing:
    a) The FLash Source (file: timer_module.fla) - (FLA flash source file - Flash CS3 Professional, Flash Player 9, actionscript 3.0)
    b) com.othenticmedia.utils.dateAndTimeManagement package including 2 .as actionscript 3.0 Class files.
           i) com.othenticmedia.utils.dateAndTimeManagement.DateAndTimeManager Class in the said package. (file: DateAndTimeManager.as)
           ii) com.othenticmedia.utils.dateAndTimeManagement.CountdownTimer Class in the package. (file: CountdownTimer.as)
    c) The compiled SWF file version of this Application's blueprint. (file: timer_module.swf).
    What i need to confirm is: ........................................................ see the next post of mine. (for Problems  need to be Resolved)

    Problems to Resolve:
    Problem#1) - Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place.
    Problem#2) - Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true;
    Problem#1 Description:
    I need to pinpoint the Logical TimeSync Exception, i am still unable to figure out. That is I'm using a webservice in my Application to Synchronize the Time with the actual ET (eastern time) with accomodation of auto-adjustment for EDT GMT-4 (eastern daylight time) & EST GMT-5 (eastern standard time), times. I am using the zipcode: "10012" to pass it to the Web Service in urlRequest object, to retrieve the Current ET eastern time according to EDT & EST time settings for Manhattan/Brooklyn areas or others within  New York, NY 10012.
    Currently the Web Service is returning accurate date/time based on local EDT GMT-4 daylight time.
    Is there some defined set of dates for EDT & EST times for New York region that I can check for to ensure the correct Dates/Times for Eastern Time in New York area ??? I am using NY zipcodes because i am sure to get correct ET values.
    The Major Problem Part: is I need to correct the time by 2 seconds or approx. 2 secs, some millisecs.
    When I retrieve the Time Value from WebService, it lags behind for 2 seconds as compared to DateObj i create using computer's local time, on my Windows XP Service Pack 2 with Automatic Updates turned-on. And I'm sure about my Windows will be having latest updates for Time Management already installed. I also added the 2 secs. to the TimeSync(ed) Date to make correction to this Date obj.
    I call my custom fucntion addSeconds(dateObj:Date, secs:int) to add 2 seconds to the Date by Converting Seconds to Milliseconds.
    Please comb through the as code in files attached and Help Me Out !!!
    Problem#2 Description:
    Secondly I need to Detect the End of Stream state while using FLVPlayback component, an rtmp:// live Stream from FLASH MEDIA SERVER.
    I need to Play a YuMe Post-Roll Ad when Steam Finishes/Ends.
    Live Broadcast Stream Event starts every night on Wednesdays & Saturdays exactly  at 10:59 PM EDT GMT-4.
    Live Events only Streams/Broadcasts the stream for 50secs. exactly. When [playback stopped] it plays a PostRoll Ad and after the CountdownTimer again comes back to life. The Next upcoming Event is calculated & the Countdown begins until Next Event's time/date is reached.
    Here is the  code on the frame 1 on the MainTimeline: (rest of the params like source, volume, skinAutoHide are Set using Property Inspector for FLVPlayback instance on Stage)
    //myStream instance of FLVPlayback is on the Stage
    myStream.isLive = true;// Frame 1 Actions in the FLA
    myStream.addEventListener(VideoEvent.COMPLETE, onEndOfStream);
    myStream.addEventListener(VideoEvent.STATE_CHANGE, onState);
    myStream.addEventListener(String(VideoError.NO_CONNECTION), onStreamError);
    myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    /*if(myStream.stopped){
         trace("tracy: "+myStream.state);
    } else if(myStream.state == VideoState.STOPPED){
         trace("tracy: "+myStream.state);
    function onStreamError(event:VideoError) {
         trace(event.code + "\n\t" + event);
    function onState(event:VideoEvent) {
         trace(event.state + "\n\t" + event.toString());
    function onEndOfStream(event:VideoEvent) {
         trace(event.state + "\n\t" + event.toString());
    function netStatusHandler(event:NetStatusEvent):void {
         switch (event.info.code) {
              case "NetConnection.Connect.Success":
                   //connectStream();
                   break;
              case "NetStream.Play.StreamNotFound":
                   trace("Stream not found: "/* + myStream.source*/);
                   break;

  • J2ME Countdown Timer

    I'm working on a J2ME game that requires the use of a countdown timer. I've put in a Timer.scheduleAtFixedRate call inside my run() method, but apparently it's taking up a lot of resources and it's proceeding too fast (a 3-minute countdown will finish in about 30 seconds or less).
    I have a separate method that calculates the amount of time left in terms of minutes and seconds, and the output will jump irregularly (say from 2:59 to 1:13 to 0:57, and so on).
    Here's the piece of code in question:
        public void run() {
            Thread currentThread = Thread.currentThread();
            //timeLeftInMillis is an int
            timeLeftInMillis = 180000;
            try
                // This ends when myThread is set to null, or when
                // it is subsequently set to a new thread; either way, the
                // current thread should terminate.
                while (currentThread == myThread)
                    //myTimer is a Timer object instantiated in the
                    //constructor
                    myTimer.scheduleAtFixedRate(new TimerTask () {
                        public void run(){
                            GameScreen.timeLeftInMillis=GameScreen.timeLeftInMillis-1000;
                            System.out.println(GameScreen.timeLeftInMillis);
                            if (GameScreen.timeLeftInMillis<= 0) {
                                    synchronized (this) {
                                        GameScreen.isGameOver = true;
                                        this.cancel();
                    }, 0, 1000L);
                    repaint(0, 0, screenWidth, screenHeight);
                    serviceRepaints();
            catch (Exception e)
        }Can anyone help me figure out what's wrong with this timer? Any help at all would be appreciated.
    Thanks. :)

    Problem solved. :)
    Comments are welcome. :)
        public void run()
            int millis_per_tick = 100;
            int counter = 1000/millis_per_tick;
            timeLeftInMillis = 180000;
            Thread currentThread = Thread.currentThread();
            try
                // This ends when myThread is set to null, or when
                // it is subsequently set to a new thread; either way, the
                // current thread should terminate.
                while (currentThread == myThread)
                    long startTime = System.currentTimeMillis();
                    repaint(0, 0, screenWidth, screenHeight);
                    serviceRepaints();
                    long timeTaken = System.currentTimeMillis() - startTime;
                    if (timeTaken < millis_per_tick)
                        synchronized (this)
                            wait(millis_per_tick - timeTaken);
                    if (counter == 0) {
                        timeLeftInMillis = timeLeftInMillis - 1000;
                        counter = 1000/millis_per_tick;
                    else
                        counter--;
                    if (timeLeftInMillis<0) {
                        synchronized(this){
                            isGameOver = true;
            catch (InterruptedException e)
        }

  • Countdown timer in FCE

    Hello there. I wonder if someone can help me. Is there a way in FCE that I can create a countdown timer (say from 5 minutes).
    I would like this over a still image or over a video clip?
    If not FCE is there any software that I may be able to use.
    Your help is appreciated.
    rob

    Last year i5m made a counter for FCE which can display minutes, seconds and frames.
    It actually counts UP but with a bit of trickery you can reverse it to make it count DOWN:-
    http://homepage.mac.com/heywood_si/i5m/archives/2005/11/
    I have the reversal instructions somewhere that were written by Piero Fiorani.
    The counter can be customised with size, font, position on screen and colour etc.
    Ian.

  • Countdown timer E52

    Just wondering: what is the logic was in effect when it was decided to make a phone that can switch from business to personal mode and then leave out a basic feature as a countdown timer? I’m not an expert but come on. The countdown timer is standard in much cheaper Nokia phones but not in the E52? This should be attended to in a future software update.

    Because there are at least 20 free countdown timers out there on the net for the E52 and each one is better than the preloaded ones on cheaper Nokia phones?
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

Maybe you are looking for

  • Problem in Report Templetes of User defined COA

    Hi I have user defined Chart of Account.That means i have to prepare templetes for each reports such as Balance sheet, P/L statement, trial balance.But im not able to get how to prepare it.There is option of just naming the titles and active accounts

  • Mac mini audio input

    It says that the mac mini has "optical digital audio input/audio line in" (http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID?nnmm=br owse&mco=9BF2D40D&node=home/desktop/mac_mini), but i've tried two microphones now and neither

  • 3KEH Balance Sheet Values not updated in Profit Center

    Hello Peofit Center experts I have Assigned Profit Center for few balance Sheet Accounts in 3KEH.But values are not updated in respective Profit Centers. I have to do any configuration settings for transfer Balance Sheet accounts to Profit center or

  • PAYMENT INFO ON iTUNES

    WHEN I PUT MY CREDITCARD INFO... IT KEEPS TELLING ME TO CONTACT iTUNES SUPPORT!!! CAN ANYONE HELP ME?

  • Extending functionality from existing custom taglib

    Hi! I'm trying to extend the functionality of an already existing custom taglib. To test this possibility I�ve so far created a small taglib containing two tags. QbeTag.java and QbeSumTag.java. The QbeTag class handles a database connection and const