Solved

ASP.Net Countdown Timer VB.Net

Posted on 2013-06-23
3
814 Views
Last Modified: 2013-08-03
Hi Experts,

I am looking for a count down timer that will count down for 1 year...

the way i want it to display is

Days remaining,  Hours, minutes, seconds

so, for example i want it to count down from 7th June 2013 to an event running on the 7th June 2014 at 13:30:00

I want it to show :

358 Days 15 hours 23 Minutes 15 minutes 23 Seconds

Any and all help would be very much appreciated... Ive not done anythign like this before and there are so many examples but in C# and not too clear...

thanks

Simon
0
Comment
Question by:SimonPrice33
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Sammy earned 500 total points
ID: 39269971
if you are working with ASP.NET, you will need the timer in javascript. not VB or C#.
if you replace CONTROL_NAME_WHERE_COUNTER_TO_SHOW with the element you want the counter to show on, the script will show you the count down.


function CountToMyEvent() {
      now      =Date.parse("June 07, 2013 23:59:59");
      kickoff  = Date.parse("June 07, 2014 13:30:00");
      diff = kickoff - now;

      days  = Math.floor( diff / (1000*60*60*24) );
      hours = Math.floor( diff / (1000*60*60) );
      mins  = Math.floor( diff / (1000*60) );
      secs  = Math.floor( diff / 1000 );

      dd = days;
      hh = hours - days  * 24;
      mm = mins  - hours * 60;
      ss = secs  - mins  * 60;

        document.getElementById("CONTROL_NAME_WHERE_COUNTER_TO_SHOW")
            .innerHTML =
                dd + ' days ' +
                hh + ' hours ' +
                mm + ' minutes ' +
                ss + ' seconds';
}
setInterval('CountToMyEvent()', 1000 )

Credit: script adopted from http://nithinbekal.com/2009/javascript-how-to-create-a-simple-countdown-timer/

good luck
0
 

Author Comment

by:SimonPrice33
ID: 39275555
hi thanks for this i will take a look later this evening
0
 

Author Closing Comment

by:SimonPrice33
ID: 39379101
thank you
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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