HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media


Welcome to TinyPortal. Please login or sign up.

March 20, 2023, 09:48:22 AM

Login with username, password and session length
  • Total Posts: 194,243
  • Total Topics: 21,145
  • Online today: 61
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 0
Guests: 37
Total: 37

Countdown date/clock

Started by ICE, February 26, 2006, 01:52:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I've got a nice tool that counts down to a specific date and time (even ms).
I attached it to this topic.

Its very simple, though there is a small problem which I can't fix right now.

- Unzip the archive.
- Place the entire map clock in the Forum directory.
- Open the file demo.js in the map clock and change ALL inserted directories into yours. For example: I changed everything into:

Quote (following with clock/)

- Change the date (line 121)

There is probably the problem to find. Try it out yourself. You will see the script ads 1 month extra!!!

- Upload the entire map clock to the server.
- Make with TP a new SCRIPT block.
- Insert the next text into this block:

<script type="text/javascript"src=""></script>

View the attached file to see what result this script gives.

I hope you guys can use it, but more I hope somebody can fix the problem!

[attachment deleted by admin]


Just Don't use Theme_title / or Theme_frame.. uncheck all.



Looks like we are all just a confused bunch here... lol

I don't quite get what you are saying ICE. I only see 1 month displayed.. I think Crip thought you were talking about the block header and title because you're arrow was pointing at it. Can you explain what you mean any better? sorry...


I will do my best ICHBIN!

I will use an example for this:
Say you want to scedule the first Grand Prix Formula 1 of this year on March, 12th at exactly 12.30.
If I took a look today, February, 26th at 21.30, the clock would give me:
0000 year, 1 month, 13 days, 15 hours, 00 minutes and 00 seconds.

That 1 month is not correct, because it is only 13 days left, dont you think? That is what I mean. So my guess is, I'm doing something wrong or the counter isnt counting like he should count !! ;)

Hope you understand me this time!

Bye the way, how do you like the script so far?


O, something important to tell:

I installed the script on my board at , and it may seem that the clock is working, but I changed the setup-date in the script to: February, 12th !!!. That's why he's showing the correct number of days now !!! (Not 1 month) I know, it aint the correct way, but it's the only way for now !


Fixed.. i for yaz
(old coder / debugger / testing powers!) O0

i don't know why but when i  added this line ( that logicaly should not be needed) it works fine.

bad code lived here (removed see next post

I don't know why this line is needed but was meant to be a debug test i put in to check to see if logic in rest of code was ok .. and it is .. and it works with this line added..  so done.

Prolly some dumbness in not being able to have month - month < 1


ok nother small bug ..
(still wrong  LOL ?)
seems this is needed see arrow #2

if (x26 >= x16) s = x26 - x16;
else {s = 60+x26-x16; x15 = x15+1; }
if (x25 >= x15) min = x25 - x15;
else { min = 60+x25-x15; x14 = x14+1; }
if (x24 >= x14) h = x24 - x14;
else { h = 24+x24-x14; x13 = x13+1; }
if (x23 >= x13) d = x23-x13;
else { d = GetDayCount(x11,x12) + x23-x13; x22 = x22-1; }
if (x22 >= x12) m = x22-x12-1;         <----------------------#2----------- this line
else { m = 12+x22-x12; x11 = x11+1; }
if (x22 == x12) m = 0;                     <----------------------#1----------- this line
y = x21 - x11;

arrow #1 is only to make shure no devide by zeros happen but should be logicaly ok to remove line marked by arrow #1
arrow #2 shows the -1 added.  don't know why but works for me.
i wonder if  ther is a "=" where a "==" should be  ?? hmm


Trying to make sense out of this.

So, If I read this the right way, and I believe I do, I should remove line 1.
Thats all??


hey  ice the error is deeper .. i tested a whole range of dates .. it has to do with how you are rounding the days down ..

see that fixes the month number but  ups the  days by the value of a month .. so the rror is in that code block or the get  number of days function...

I'm on sic leave for a number of months so i'll figure it out ..LOL


Just great, but don't let the installed clock on my forum fool you! I've installed it at the date February 12Th instead of March 12Th. Just to be sure the bell will ring on the date I want it to ring.

And I am still not sure I know what you mean. However it feels kinda strange that this type of countdownclock does not work. But I'll see what you can find in the code. Many thanx!


Hey guys

I have just put in my site a countdown block which is a js file.  Low and behold I put a date and time in and its out by about 8 hours or so.  Whats wrong with this script???


Is this script working ?

I would like to make it into a world cup countdown.


I have just used this script but end up with a blank box. Obviously i'm doing something wrong can someone give me a step by step? type slowly please cos i can't read very fast ;)


Read the steps in the first post and you will find out whats wrong.
My first guess is that you have the wrong path set where you should change according to the info in the first post.
Or you have the wrong type of block.
Make sure you have a script block and not a php


do i put them in the /forum directory including the demo file?


I've used both countup and countdpown scripts. Both work fine for me.


Quote from: Xarcell on September 05, 2006, 02:03:52 PM
I've used both countup and countdpown scripts. Both work fine for me.

do i put them in the /forum directory including the demo file?


If you read the instructions it says exactly that.

Quote- Place the entire map clock in the Forum directory.


That's what i've done and i just get a blank block  ???

edit...unless i actually use his code as it's written

<script type="text/javascript"src=""></script>

then i just get a countdown clock


Change the url path to your own instead of his, look at the blue link text and put your own forum url there (the same you write to get to your forum


This is the code I am using for a count down to xmas.  As far as I can tell it has an added hour but corrects itself once daylight savinges time ends.  Is there a code that will automatically correct this?

<font Size=1><center><script language="JavaScript">
TargetDate = "12/25/2006 00:00:00 AM";
BackColor = "";
ForeColor = "#476C8E";
CountActive = true;
CountStepper = -1;
DisplayFormat = "%%D%% Days, %%H%% Hrs,<br>%%M%% Mins, %%S%% Secs. <br>Until Santa comes to visit.";
FinishMessage = "<b>Merry Christmas!</b>";
<script language="JavaScript" src=""></script></center></font>


Any update on this? It looks really cool and I'd like to use it.

If it is working, which script would be used?


This is the one I use.  Put it in a scriptbox.  I got it from this thread I believe. 

<script language="JavaScript1.2">

Dynamic countdown Script- Ã...  Dynamic Drive (
For full source code, 100's more DHTML scripts, and TOS,

function setcountdown(theyear,themonth,theday){
//////////CONFIGURE THE COUNTDOWN SCRIPT HERE//////////////////

//STEP 1: Configure the countdown-to date, in the format year, month, day:

//STEP 2: Change the two text below to reflect the occasion, and message to display on that occasion, respectively
var occasion="your occasion here"
var message_on_occasion="message on the occasion!"

//STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countdown area
var countdownwidth='360px'
var countdownheight='10px'
var countdownbgcolor='blue'
var opentags='<font face="Verdana"><center>'
var closetags='</font></center>'

//////////DO NOT EDIT PASS THIS LINE//////////////////

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var crosscount=''

function start_countdown(){
if (document.layers)
else if (document.all||document.getElementById)
crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie

if (document.all||document.getElementById)
document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')


function countdown(){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[mo-1]+" "+da+", "+yr
//if on day of occasion
if (document.layers){
else if (document.all||document.getElementById)
//if passed day of occasion
else if (dday<=-1){
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+"Occasion already passed! "+closetags)
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+"Occasion already passed! "+closetags
//else, if not yet
if (document.layers){
document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags)
else if (document.all||document.getElementById)
crosscount.innerHTML=opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags

<ilayer id="countdownnsmain" width=&{countdownwidth}; height=&{countdownheight}; bgColor=&{countdownbgcolor}; visibility=hide><layer id="countdownnssub" width=&{countdownwidth}; height=&{countdownheight}; left=0 top=0></layer></ilayer>


Tick - That worked great! It's now being implemented in one of my boards.