Countdown Timer

Not sure if this is in the right category.

Can anyone help me?  I need a countdown page for someone who is retiring in 3 + years.
I would like this to look as professional as possible.  

This is what I would like -
(Everything is centered in Large Type)

Roxanne's Retirement Countdown Clock

September 30, 2009 at 5 p.m.

(Display Countdown)
Months

(Display Countdown)
Days

(Display Countdown)
Hours

(Display Countdown)
Minutes

(Display Countdown)
Seconds

If it's not pushing my luck is it possible to have two versions. One that includes weekends and the other excluding them.

I hope this isn't asking too much. Web languages are not my forte.

Thanks in advance for your help.
master-monkeyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nabsolCommented:
Hi

Below is the code. Hope this helps

<html>
<head>
<script language="JavaScript">


function startCountDown()
{
TargetDate = "09/30/2009 5:00 PM";  // this is target time

var dthen = new Date(TargetDate);   //target time date
var dnow = new Date();              //current date    
ddiff = new Date(dthen-dnow);       // diffference      
gsecs = Math.floor(ddiff.valueOf()/1000);   //getseconds
CountBack(gsecs);         //call count down
}

function calcage(secs, num1, num2)   //will take seconds and convert to minutes hours days etc
{
  s = ((Math.floor(secs/num1))%num2).toString();
  if (s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";    //return number (unit)
}

function CountBack(secs)
{
  if (secs < 0) {
    document.getElementById("finished").innerHTML = "Roxanne's Retired";   //retired message
    return;
  }

  document.getElementById("mymonths").innerHTML = calcage(secs,2592000,100000);  //calculate months
  document.getElementById("mydays").innerHTML = calcage(secs,86400,30);    //calculate days
  document.getElementById("myhours").innerHTML = calcage(secs,3600,24);    //calculate hours
  document.getElementById("mymin").innerHTML = calcage(secs,60,60);        //calculate minutes
  document.getElementById("mysec").innerHTML = calcage(secs,1,60);         //calculate seconds

  setTimeout("CountBack(" + (secs-1) + ")", 990);
}
</script>
</head>

<body onload="startCountDown()">

<table border="1" bordercolor="#A8A9A0" width="80%" align="center">
<tr><td align="center">Roxanne's Retirement Countdown Clock</td></tr>
<tr><td align="center">September 30, 2009 at 5 p.m.</td></tr>
<tr><td align="center"><div id="mymonths"></div> Months</td></tr>
<tr><td align="center"><div id="mydays"></div> Days</td></tr>
<tr><td align="center"><div id="myhours"></div> Hours</td></tr>
<tr><td align="center"><div id="mymin"></div> Minutes</td></tr>
<tr><td align="center"><div id="mysec"></div> Seconds</td></tr>
<tr><td align="center"><div id="finished"></div></td></tr>
</table>
</body>
</html>


By Nab
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nabsolCommented:
Hi
This is socond one. This exclude the weekends. But may be it will be approximate as assumption is that averagely month is of 30 days and there will be 8 days excluded from every month. as 4 weeks and 2 weekend days. Hope this helps

<html>
<head>
<script language="JavaScript">


function startCountDown()
{
TargetDate = "09/30/2009 5:00 PM";  // this is target time

var dthen = new Date(TargetDate);   //target time date
var dnow = new Date();              //current date    
ddiff = new Date(dthen-dnow);       // diffference      
gsecs = Math.floor(ddiff.valueOf()/1000);   //getseconds

gmonths = Math.floor(gsecs/2592000)     //calculate months
gdays = Math.floor(gsecs/86400)    //calculate days

gdays = gdays - (gmonths*8)  //subtract by (totalmonths*8) i.e. total weekend days (8 in one month)
gsecs = gdays*86400     //get seconds back

CountBack(gsecs);         //call count down
}

function calcage(secs, num1, num2)   //will take seconds and convert to minutes hours days etc
{
  s = ((Math.floor(secs/num1))%num2).toString();
  if (s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";    //return number (unit)
}

function CountBack(secs)
{
  if (secs < 0) {
    document.getElementById("finished").innerHTML = "Roxanne's Retired";   //retired message
    return;
  }

  document.getElementById("mymonths").innerHTML = calcage(secs,2592000,100000);  //calculate months
  document.getElementById("mydays").innerHTML = calcage(secs,86400,30);    //calculate days
  document.getElementById("myhours").innerHTML = calcage(secs,3600,24);    //calculate hours
  document.getElementById("mymin").innerHTML = calcage(secs,60,60);        //calculate minutes
  document.getElementById("mysec").innerHTML = calcage(secs,1,60);         //calculate seconds

  setTimeout("CountBack(" + (secs-1) + ")", 990);
}
</script>
</head>

<body onload="startCountDown()">

<table border="1" bordercolor="#A8A9A0" width="80%" align="center">
<tr><td align="center">Roxanne's Retirement Countdown Clock (Excluding Weekends)</td></tr>
<tr><td align="center">September 30, 2009 at 5 p.m.</td></tr>
<tr><td align="center"><div id="mymonths"></div> Months</td></tr>
<tr><td align="center"><div id="mydays"></div> Days</td></tr>
<tr><td align="center"><div id="myhours"></div> Hours</td></tr>
<tr><td align="center"><div id="mymin"></div> Minutes</td></tr>
<tr><td align="center"><div id="mysec"></div> Seconds</td></tr>
<tr><td align="center"><div id="finished"></div></td></tr>
</table>
</body>
</html>

By Nab
0
master-monkeyAuthor Commented:
Excellent. Thanks a lot. All I need to do now is the design but I can do that.

Thanks again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.