Solved

ASP.Net Countdown Timer VB.Net

Posted on 2013-06-23
3
871 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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