Solved

ASP.Net Countdown Timer VB.Net

Posted on 2013-06-23
3
788 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
Comment Utility
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
Comment Utility
hi thanks for this i will take a look later this evening
0
 

Author Closing Comment

by:SimonPrice33
Comment Utility
thank you
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now