Javascript Countdown Clock

In the bottom block of this script, I only want the date to be showed.  I do not need the other time loking thing or the UTC.  Not even sure what this stuff represents.  Here's the code:

<HTML>
<HEAD>

<SCRIPT>


//change your event date event here.
var eventdate = new Date("May 10, 2009  00:00:00 EST");

 function toSt(n)
 {s=""
  if(n<10) s+="0"
  return s+n.toString();
 }
 
 function countdown()
 {cl=document.clock;
  d=new Date();
  count=Math.floor((eventdate.getTime()-d.getTime())/1000);
  if(count<=0)
    {cl.days.value ="----";
     cl.hours.value="--";
     cl.mins.value="--";
     cl.secs.value="--";
     return;
    }
  cl.secs.value=toSt(count%60);
  count=Math.floor(count/60);
  cl.mins.value=toSt(count%60);
  count=Math.floor(count/60);
  cl.hours.value=toSt(count%24);
  count=Math.floor(count/24);
  cl.days.value=count;    
 
  setTimeout("countdown()",500);
 }
// end script -->
</SCRIPT>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="blue" LINK="#80FF00" VLINK="#FF00FF"

ALINK="#FF0000"
 onLoad="countdown()">

<center>
<P>
<FORM name="clock"></P>
<CENTER>
<TABLE BORDER=5 CELLSPACING=2 CELLPADDING=0 BGCOLOR="#ffffff" >
<TR>
<TD ALIGN=CENTER WIDTH="31%" BGCOLOR="gray"><B>Days:</B></TD>
<TD ALIGN=CENTER WIDTH="23%" BGCOLOR="gray"><B>Hours:</B></TD>
<TD ALIGN=CENTER WIDTH="23%" BGCOLOR="gray"><B>Mins:</B></TD>
<TD ALIGN=CENTER WIDTH="23%" BGCOLOR="gray"><B>Secs:</B></TD>
</TR>

<TR>
<TD ALIGN=CENTER><INPUT name="days" size=4></TD>
<TD ALIGN=CENTER><INPUT name="hours" size=2></TD>
<TD ALIGN=CENTER><INPUT name="mins" size=2></TD>
<TD ALIGN=CENTER><INPUT name="secs" size=2></TD>
</TR>

<TR>
<TD COLSPAN="4" BGCOLOR="#ffffff">
<center><FONT SIZE=+2>Left before:</FONT></center>
</TD>
</TR>

<TR>
<TD COLSPAN="4" BGCOLOR="#ffffff">
<center><FONT SIZE=+2>Gymnastics Meet</FONT></center>
</TD>
</TR>

<TR><TD COLSPAN="4" BGCOLOR="#000000"><CENTER><FONT SIZE=+1 COLOR="#00FF00">
<script>
 document.write(" "+eventdate.toGMTString()+" ");
</script>
</FONT></CENTER></TD></TR>

</TABLE></CENTER>

<P></FORM></P>

</BODY>
</HTML>

lpetrowiczAsked:
Who is Participating?
 
Sreedhar VengalaSr. Consultant - Business IntelligenceCommented:
Ok here it goes:


<HTML>
<HEAD>
 
<SCRIPT>
 
var month=new Array(12);
month[0]="January";
month[1]="February";
month[2]="March";
month[3]="April";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="August";
month[8]="September";
month[9]="October";
month[10]="November";
month[11]="December";
 
//change your event date event here.
var eventdate = new Date("May 10, 2009  00:00:00 EST");
 
 function toSt(n)
 {s=""
  if(n<10) s+="0"
  return s+n.toString();
 }
 
 function countdown()
 {cl=document.clock;
  d=new Date();
  count=Math.floor((eventdate.getTime()-d.getTime())/1000);
  if(count<=0)
    {cl.days.value ="----";
     cl.hours.value="--";
     cl.mins.value="--";
     cl.secs.value="--";
     return;
    }
  cl.secs.value=toSt(count%60);
  count=Math.floor(count/60);
  cl.mins.value=toSt(count%60);
  count=Math.floor(count/60);
  cl.hours.value=toSt(count%24);
  count=Math.floor(count/24);
  cl.days.value=count;    
  
  setTimeout("countdown()",500);
 }
// end script -->
</SCRIPT>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="blue" LINK="#80FF00" VLINK="#FF00FF" 
 
ALINK="#FF0000" 
 onLoad="countdown()">
 
<center>
<P>
<FORM name="clock"></P>
<CENTER>
<TABLE BORDER=5 CELLSPACING=2 CELLPADDING=0 BGCOLOR="#ffffff" >
<TR>
<TD ALIGN=CENTER WIDTH="31%" BGCOLOR="gray"><B>Days:</B></TD>
<TD ALIGN=CENTER WIDTH="23%" BGCOLOR="gray"><B>Hours:</B></TD>
<TD ALIGN=CENTER WIDTH="23%" BGCOLOR="gray"><B>Mins:</B></TD>
<TD ALIGN=CENTER WIDTH="23%" BGCOLOR="gray"><B>Secs:</B></TD>
</TR>
 
<TR>
<TD ALIGN=CENTER><INPUT name="days" size=4></TD>
<TD ALIGN=CENTER><INPUT name="hours" size=2></TD>
<TD ALIGN=CENTER><INPUT name="mins" size=2></TD>
<TD ALIGN=CENTER><INPUT name="secs" size=2></TD>
</TR>
 
<TR>
<TD COLSPAN="4" BGCOLOR="#ffffff">
<center><FONT SIZE=+2>Left before:</FONT></center>
</TD>
</TR>
 
<TR>
<TD COLSPAN="4" BGCOLOR="#ffffff">
<center><FONT SIZE=+2>Gymnastics Meet</FONT></center>
</TD>
</TR>
 
<TR><TD COLSPAN="4" BGCOLOR="#000000"><CENTER><FONT SIZE=+1 COLOR="#00FF00">
<script>
document.write(" "+eventdate.getDate()+'-'+month[eventdate.getMonth()]+'-'+eventdate.getFullYear()+" ");
</script>
</FONT></CENTER></TD></TR>
 
</TABLE></CENTER>
 
<P></FORM></P>
 
</BODY>
</HTML>

Open in new window

0
 
Sreedhar VengalaSr. Consultant - Business IntelligenceCommented:
change:
<script>
 document.write(" "+eventdate.toGMTString()+" ");
</script>
to:
<script>
 document.write(" "+eventdate.getDate()+'-'+eventdate.getMonth()+'-'+eventdate.getFullYear()+" ");
</script>
0
 
lpetrowiczAuthor Commented:
This is good but it's a month off.  Meaning, I put in My ad it shows up 4 (april).  also, how would I make the month name show up instead of the number like it was doing?
0
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.

All Courses

From novice to tech pro — start learning today.