# Date problem

**URL:** <https://forum.kirupa.com/t/date-problem/178931>\
**Category:** Uncategorized\
**Created:** [February 15, 2006, 3:06pm UTC](https://forum.kirupa.com/t/date-problem/178931 "2006-02-15T15:06:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blowfish](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blowfish/32/744_2.png) [@Blowfish](https://forum.kirupa.com/u/Blowfish)\
**Post date:** [February 15, 2006, 3:06pm UTC](https://forum.kirupa.com/t/date-problem/178931/1 "2006-02-15T15:06:11Z")

</div>

Iw been searching high and low the last days after a tutorial that actually work and thats not to advanced. I stumbled over this code the other day:

PHP Code:  
[LEFT][COLOR=#000000][COLOR=#ff8000]// Date.countdown Method v1.0[/LEFT]  
// by Jonas Galvez ([jonas@onrelease.org](mailto:jonas@onrelease.org))  
[/COLOR][COLOR=#0000bb]Date[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]prototype[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]countdown [/COLOR][COLOR=#007700]= function([/COLOR][COLOR=#0000bb]obj[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]\_onStatus[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]\_onFinish[/COLOR][COLOR=#007700]) {  
var [/COLOR][COLOR=#0000bb]ms [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]24 [/COLOR][COLOR=#007700]\* [/COLOR][COLOR=#0000bb]60 [/COLOR][COLOR=#007700]\* [/COLOR][COLOR=#0000bb]60 [/COLOR][COLOR=#007700]\* [/COLOR][COLOR=#0000bb]1000[/COLOR][COLOR=#007700];  
var [/COLOR][COLOR=#0000bb]timer [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]setInterval[/COLOR][COLOR=#007700](function([/COLOR][COLOR=#0000bb]o[/COLOR][COLOR=#007700]) {  
var [/COLOR][COLOR=#0000bb]\_current [/COLOR][COLOR=#007700]= new [/COLOR][COLOR=#0000bb]Date[/COLOR]COLOR=#007700;  
var [/COLOR][COLOR=#0000bb]\_days [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]Math[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]floor[/COLOR]COLOR=#007700;  
var [/COLOR][COLOR=#0000bb]\_hours [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]Math[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]abs[/COLOR]COLOR=#007700;  
var [/COLOR][COLOR=#0000bb]\_minutes [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]Math[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]abs[/COLOR]COLOR=#007700;  
var [/COLOR][COLOR=#0000bb]\_seconds [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]Math[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]abs[/COLOR]COLOR=#007700;  
[/COLOR][COLOR=#0000bb]\_onStatus[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]call[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]obj[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]\_days[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]\_hours[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]\_minutes[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]\_seconds[/COLOR][COLOR=#007700]);  
if([/COLOR][COLOR=#0000bb]\_days [/COLOR][COLOR=#007700]\< [/COLOR][COLOR=#0000bb]0[/COLOR][COLOR=#007700]) { [/COLOR][COLOR=#0000bb]\_onFinish[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]call[/COLOR]COLOR=#007700; [/COLOR][COLOR=#0000bb]clearInterval[/COLOR]COLOR=#007700; };  
}, [/COLOR][COLOR=#0000bb]1000[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]this[/COLOR][COLOR=#007700]);  
};  
[/COLOR][COLOR=#0000bb]ASSetPropFlag[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]Date[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]prototype[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]“countdown”[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]1[/COLOR][COLOR=#007700]);  
var [/COLOR][COLOR=#0000bb]birthday [/COLOR][COLOR=#007700]= new [/COLOR][COLOR=#0000bb]Date[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]2006[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]4[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]26[/COLOR][COLOR=#007700]);  
var [/COLOR][COLOR=#0000bb]myOnStatus [/COLOR][COLOR=#007700]= function([/COLOR][COLOR=#0000bb]days[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]hours[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]minutes[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]seconds[/COLOR][COLOR=#007700]) {  
[/COLOR][COLOR=#0000bb]\_root[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]messageText [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]days [/COLOR][COLOR=#007700]+[/COLOR][COLOR=#dd0000]" days, “[/COLOR][COLOR=#007700];  
[/COLOR][COLOR=#0000bb]\_root[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]messageText [/COLOR][COLOR=#007700]+= [/COLOR][COLOR=#0000bb]hours [/COLOR][COLOR=#007700]+ [/COLOR][COLOR=#dd0000]” hours, " [/COLOR][COLOR=#007700]+ [/COLOR][COLOR=#0000bb]minutes [/COLOR][COLOR=#007700]+ [/COLOR][COLOR=#dd0000]" minutes"[/COLOR][COLOR=#007700];  
[/COLOR][COLOR=#0000bb]\_root[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]messageText [/COLOR][COLOR=#007700]+= [/COLOR][COLOR=#dd0000]" and " [/COLOR][COLOR=#007700]+ [/COLOR][COLOR=#0000bb]seconds [/COLOR][COLOR=#007700]+ [/COLOR][COLOR=#dd0000]" secunds left"[/COLOR][COLOR=#007700];  
};  
var [/COLOR][COLOR=#0000bb]myOnFinish [/COLOR][COLOR=#007700]= function() {  
[/COLOR][COLOR=#0000bb]\_root[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]messageText [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]“Countdown done”[/COLOR][COLOR=#007700];  
};  
[/COLOR][COLOR=#ff8000]// the 1st parameter indicates  
// the object to which the callbacks will be applied  
[/COLOR][COLOR=#0000bb]birthday[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]countdown[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]this[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]myOnStatus[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]myOnFinish[/COLOR][COLOR=#007700]);  
[/COLOR][/COLOR]

The problem is this \>

**var birthday = new Date(2006, 4, 26); //Should be april 26 2006**

Looks fine right? But when i make the swf file it looks like this:

[http://www.kirupa.com/forum/attachment.php?attachmentid=33619&d=1139988569](http://www.kirupa.com/forum/attachment.php?attachmentid=33619&d=1139988569)

As u can see, 99 days to April 26? Dont think so. Should be more like 50-60 days max.  
So my question is: how do i get this script to work? How can i fix it?  
Plz be aware that im not that good of a coder :block: Be gentle

_**[COLOR=red]Question 2:[/COLOR]**_  
[COLOR=black]I aslo need 2 insert a line that counts down to a certain time aslo \>[/COLOR]  
18.30 \> total output should show \> April 26 2006 18.30 CET  
Same problem here, have no clue how i should script it and i cant find a tutorial.

Well, i realy hope that someone can help me with the first problem, since its more importent then the second. And i know ppl dont like beeing asked to scrip for other ppl, but im hoping its a small thing for someone that knows there \*\*\*\* :hoser:

Many thx
