Countdown To Date?
I know this is asked often, but I can't seem to locate it, so here goes...
who knows how to create a countdown timer that you can enter (or program) the date and it will countdown to that date in the specified format?
I did it 2 years ago for my weddig but can't find the file and cant remember how I did it.
thanks in advance. steve
FlashKit > Flash Help > Flash General Help
Posted on: 08-28-2003, 11:52 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Countdown To Date, Loading Date From Txt
Hey everyone,
I'm working on a Flash movie to countdown to a certain date, and I am wanting to assign that date in a .txt file so it is easy to change the date without modifying the FLA.
Here's the ActionScript I have for finding the date it's counting down to from the .txt file:
loadText = new loadVars();
loadText.load("date.txt");
loadText.onLoad = function() {
eventDate = new Date(this.year, this.month, this.day);
};
And the date.txt file has this in it:
year=2003&month=12&day=25
It doesn't seem to be working :- .
Any help would be awesome .
-Nick
Countdown To Date, Loading Date From Txt
Hey everyone,
I'm working on a Flash movie to countdown to a certain date, and I am wanting to assign that date in a .txt file so it is easy to change the date without modifying the FLA.
Here's the ActionScript I have for finding the date it's counting down to from the .txt file:
loadText = new loadVars();
loadText.load("date.txt");
loadText.onLoad = function() {
eventDate = new Date(this.year, this.month, this.day);
};
And the date.txt file has this in it:
year=2003&month=12&day=25
It doesn't seem to be working :- .
Any help would be awesome .
-Nick
Date Countdown
I am trying to figure out how to make a countdown wit the date instead of until midnight...there is a tutorial that does it till midnight, but I am trying to counto down to October 28...help?
Date Countdown Help
Hi
Could anyone tell me how to create a time and date count down ie. 12 days 23 hours 45 mins and 30 secs left.
Any help would be greatly appreciated.
Please bear in mind that while I can use flash 5 I have near zero scripting ability.
Thanks
Countdown To Date
I want to create a countown in Flash to a particular date. I have used a javascript countdown in the past, but I would rather do it in flash so I can control the font. Any suggestions?
Countdown To A Date
Hi everyone-
I'm trying to get a countdown timer to work (Flash MX) - to count down to a date. Right now, it says there are 28 days until tomorrow!
Please tell me what I'm doing wrong...
Code:
nowDate = new Date();
targetDate = new Date (2003,2,15,00);
dateDiff = targetDate - nowDate;
// display today's date
todayTextField = ((nowDate. getMonth()+1) + "/" + nowDate.getDate() + "/" + nowdate.getFullYear());
// display time remaining
timeRemainingTextField = dateDiff/(1000*60*60*24);
Date Countdown
Hi Flash/PHP experts, not sure if this posting should be in actionscripting section.
Anyway - looking for a simple script that would work in flash/php server side that would count down the days until July 31, 2005.
(i.e. 65 Days...), then next day would read 64 days... etc.
Again simple script in flash. Server very limitied (php and mysql only - no asp or Pearl).
If anyone could help - or point me in a direction I would be much appreciated.
Date Countdown
Hi there, I was wondering if anyone knew of how to make a timer countdown to a date in the future. I have found numerous movies that I can just replace the images and change the future date, but how do I make it so that the time that is "gotten" is from the server and not from the persons own computer. So that they would have to think to figure out the date ya know? not just change their pc clock. Any help would be great. thanks
Countdown To A Date
Does anybody of you have a very simple coundown script for me.
I just wanna have a very simple countdown to f.eks. my birthday 31. des.
Would be cool if it showed days, hours, minutes and seconds...
Thanks
Hawk
Countdown To A Certain Date.
Hi all,
Wondering if anyone knows of a tut for a countdown ticker.
One that counts down to a specific date.
Thanks in advance!
Help Wit Me Date Countdown
hey can anyone tell me how i go about adapting the code in the date countdown tutorial in order for me to countdown to something next year. The tut only shows how to countdown to christmas!!
Date Countdown..
Followed the tutorial to the letter, all pretty self-explanatory.
However couple of things I've been really messing around with to try and get it to do.
1. Is it a graphic only thing? Can I replicate this with standard text characters?!? I don't know enough actionscript yet to even try that hehe.
2. How do I remove the milliseconds and seconds from the display? Is it simply a case of deleting those 2 elements, I daren't try in case I break something!
Thanks in advance
Matt
Date Countdown To A Date Given In .txt
Hi!
I created a countdown movie ( http://www.2rdesign.com/help/countdown.zip ). I works nicely, but i need to pass the new date to is from an outer source. Could anyone help me out here?
Thanks!
Setting Up A Countdown Using The Date
I'm trying to find a way to use the myDate.getDate(); object to tell me the difference between two dates.
What I would like to see happen is:
I retrieve the current date (currDate)
subtract it from the deadline date (deadLine)
and display the difference.....thus the countdown
currDate - deadLine = myCountDown
Any ideas?????
Date And Time Countdown
Is it possible to create a countdown to a certain date and time (for example Monday 8th April 9.00am - 74 days, 18 hrs 10mins 34secs) and to have this as a realtime backwards clock.
Thanks
Rob
Screensaver With Date Countdown
I'm looking at designing a screen saver which must count down to a specific date when a site is to be launched. Is this possible, and where can I get my hands on the code ?
Hope someone out there can help.
Fabman
Screensaver With Date Countdown
I'm looking at designing a screen saver which must count down to a specific date when a site is to be launched. Is this possible, and where can I get my hands on the code ?
Hope someone out there can help.
Fabman
Countdown Timer To A Date?
Can someone help me.
How do i make a countdown timer in flash to a specific time on a date, like 25. september 12AM
Helpmeee.. ¬¬
How Can I Make Date Countdown?
hi
if i wnat to make a movie to remined me about my frined brthday
lets say it will be 1/11/2003
how can i let it show the remaining day for his or here brthday
and in the day zero the movie will start with fireworks
thankz for ur help in advanse
bye
Date Countdown Timer
Hello,
I am new to ActionScript and would like to either have or create a timer that counts down to a certain date.
I have searched these forums and have found this, but it is for Flash MX and I have 5, and am not sure whether the Actionscript is similar enough for it to work in my version.
If someone could provide me with a countdown or the instructions to create one in Flash 5, that'd be great.
Would it have to have the entire 'days in a month system' built into it, or would it run off the computer clock? Also, would it be difficult to go into the code and change the date that the clock counts down to for use with different occasions?
Thanks.
Countdown To Day Of The Week? (and Not Date)
Okay... just want to say that this site rocks! It's helped me a lot in the past, and I'm kinda stumped right now - hence my inquiry to the mojo masters now
[/brown nose]
Okay, now that that's out of the way, here's basically what I need to do:
I need a script that is very similar to the countdown script featured in the advanced tutorials section, but counts down to a specific day of the week & time (as opposed to a set calendar date), i.e. Mondays @ 7:00pm.
The script will be implemented on a non-commercial radio station website (http://www.kuzr.com), and will be used to show the countdown to the next live show. It will only have to store one date and time, as I plan on making multiple scripts to suit multiple shows.
So basically to simplify things, I just need a script that will count down to a specific time of a day of the week (Mon, Tues, Wed, etc) and NOT calendar dates.
Thanks for any help in advance!
Countdown To Specific Date #2
Help!
I am trying to countdown to a date next year (2005) and cannot seem to manipulate the code to make it work Help!
Code:
eventDate = new Date( 2005, 06, 16 , 18 , 0 , 0 , 0);
What am I doing wrong? Please help.
This is Flash MX.
Date Countdown From .php Or Txt Source
Hi im wondering if you knew any good tutorials or sources, descriping the problem in the title. I've got a fully functional countdown movie, but i need, to be able to load the date to countdown from, from an outer source.
thx
Date Countdown Timer
I saw the Date Countdown Timer tutorial in this page and i think its a great tutorial, but i have a problem i need a Countdown but my server doesnt suport PHP, and i try to do it in ASP but i cant make it work, please if anyone know how to do the same but with a ASP file and not with a PHP, please tell me how.
Thanks a lot for your help and please sorry my English
Date Countdown Timer
I saw the tutorial Date Countdown Timer on kirupa.com, http://www.kirupa.com/developer/mx/countdown.htm
and is a great tutorial, but is made with php and my server dosnt suport it, anyone can help me to make it work with an ASP file ?
the php file have the next code:
<?php
echo "time=" . time();
?>
but i dont know what i need in the ASP file to get the same result.
I really need this counter so please if you have time help me
Countdown - Get Date From Server With Asp?
Hi,
I have successfully managed to follow and implement the flash date countdown timer tutorial given here: http://www.kirupa.com/developer/mx/countdown.htm
However I need to get the time from my server rather than the client so that everyone see's the same time and nobody can view the rest of the movie before the deadline has been reached.
Instructions are given to get the tiome from the server using PHP, however our website runs on asp.net so i cannot use this PHP script.
I know I can call the date from my server on an aspx page with:
<% dteDate = Now %>
<%=dteDate %>
Which displays as:
19/03/2007 12:40:29
Is it possible to pull that into the countdown? If so where do I need to start?
Thanks.
Help With Date Countdown Timer
I'm completely new to Flash and while it seems pretty awesome I'm pretty lost with the scripting.
I am trying to make a date countdown timer using the direction senocular posted. I got through the graphics part, but can't get the scripting (http://www.kirupa.com/developer/mx/countdown2.htm). I tried looking at the code in the downloadable flash, but I can't make head or tails of it. I think I could get the date part down, but I can't get the movie clip part set up.
Could someone help me out? I would really like to be able to do this!! It would help to have instructions that were for a noob - I think the instructions senocular wrote are for someone more familiar with Flash... How about just the straight code that made the example work? At least then I can make my names exactly the same and work out the bugs by eliminating the differences...
Please help!
Countdown A Date In 2009?
I have a Flash countdown timer. I need it to countdown to a date in March of 2009. How do I do this? The currentDate.getFullYear(); is calculating only up to 2008!
Thanks!
Countdown To Day Of The Week? (and Not Date)
Okay... just want to say that this site rocks! It's helped me a lot in the past, and I'm kinda stumped right now - hence my inquiry to the mojo masters now
[/brown nose]
Okay, now that that's out of the way, here's basically what I need to do:
I need a script that is very similar to the countdown script featured in the advanced tutorials section, but counts down to a specific day of the week & time (as opposed to a set calendar date), i.e. Mondays @ 7:00pm.
The script will be implemented on a non-commercial radio station website (http://www.kuzr.com), and will be used to show the countdown to the next live show. It will only have to store one date and time, as I plan on making multiple scripts to suit multiple shows.
So basically to simplify things, I just need a script that will count down to a specific time of a day of the week (Mon, Tues, Wed, etc) and NOT calendar dates.
Thanks for any help in advance!
Countdown To Specific Date #2
Help!
I am trying to countdown to a date next year (2005) and cannot seem to manipulate the code to make it work Help!
Code:
eventDate = new Date( 2005, 06, 16 , 18 , 0 , 0 , 0);
What am I doing wrong? Please help.
This is Flash MX.
Date Countdown From .php Or Txt Source
Hi im wondering if you knew any good tutorials or sources, descriping the problem in the title. I've got a fully functional countdown movie, but i need, to be able to load the date to countdown from, from an outer source.
thx
Countdown To Date Code
hey..! how are you.. look i've been in a project since a quite while.. and it is getting nice.. but i have some problem with this..
check this code:
ActionScript Code:
now = new Date();
later = new Date(now.getFullYear(), 8, 1);
if (now>later) {
later = new Date(now.getFullYear()+1, 8, 1);
}
diff = int((later-now)/1000);
secs = diff%60;
mins = int((diff%3600)/60);
hours = int((diff%86400)/3600);
days = int(diff/(86400));
left = days+":"+hours+":"+mins+":"+secs;
play();
and it.. gives me this:
232:10:34:54
that is fine.. BUT.. when the second comes to one digit. i would like to get..
232:10:34:01 and NOT 232:10:34:1
does anyone have an idea?
thank you for. helping me.. i am learning to much from you guys.. its hardy to be a designer inside th AS world.
cheers..
How Do I Set The Date In This Countdown Script?
Code:
// stop the timeline
stop();
// first get this current year so this example
// remains valid for some time to come
currentDate = new Date();
thisYear = currentDate.getFullYear();
// define the event date counting down to
// this is constant so it won't need to be
// calculated in the onEnterFrame function below
// currently counting down 'til christmas of 2003
// Date( year, month-1, date [, hour [, minute [, second [, millisecond]]]])
eventDate = new Date(ThisYear, 11, 25);
eventMillisecs = eventDate.getTime();
counter.onEnterFrame = function(){
// get the current date and time as it exists at
// this instance in time when the frame is entered
currentDate = new Date();
currentMillisecs = currentDate.getTime();
// the milliseconds between the current time and the
// time of the event can then be calculated by simply
// subtracting the current time's milliseconds from the
// milliseconds of the time of the event
this.msecs = eventMillisecs - currentMillisecs;
// if the msecs variable is less than 0, that means the
// current time is greater that the time of the event
if (this.msecs <= 0){
// and the event time has been reached!
// play the next frame for the result of the countdown.
play();
// a return can be used to exit the function since
// in going to the next frame, there's no need to
// continue with the remaining operations.
return;
}
// if the date hasn't been reached, continue to
// devise seconds, minutes, hours and days from
// the calculated milliseconds
this.secs = Math.floor(this.msecs/1000); // 1000 milliseconds make a second
this.mins = Math.floor(this.secs/60); // 60 seconds make a minute
this.hours = Math.floor(this.mins/60); // 60 minutes make a hour
this.days = Math.floor(this.hours/24); // 24 hours make a day
// make sure each value doesn't exceed the range in
// which they exist. Milliseconds, for example, will
// be shown in a range of 0 - 999. The modulous
// operator, or %, well help in that. Here the values
// are also turned into strings preparing for the next step
this.msecs = string(this.msecs % 1000);
this.secs = string(this.secs % 60);
this.mins = string(this.mins % 60);
this.hours = string(this.hours % 24);
this.days = string(this.days);
// add on leading zeros for all the number values (which are
// now strings) that aren't 3 or 2 characters long based on the
// range being used to represent them. Because mseconds and
// days have up to 3 characters, a while loop is used to
// continuously add 0s until they have 3. Other values which
// only need 2 leading 0s can get by on a single if check
while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
if (this.secs.length < 2) this.secs = "0" + this.secs;
if (this.mins.length < 2) this.mins = "0" + this.mins;
if (this.hours.length < 2) this.hours = "0" + this.hours;
while (this.days.length < 3) this.days = "0" + this.days;
// finally, display your values. If you want to put your values
// in a textField, you can pretty much just stop here and throw them
// into your textField as desired. This example, however will go a step
// further and use images for numbers for each numerical value in the
// countdown to the desired date.
// So, for that, loop through all the movies in this counter clip using the
// evaluateFrameFrom prototype method on each. A single check for a
// _parent variable is used to make sure the property found in a for
// loop is a movieclip and is within the timeline of this counter clip.
// TextFields and buttons would also be true here, but since the contents
// within counter are strictly those numbers movieclips, we won't have to
// be concerned with such complications. The only movieclips in this counter
// clip are the numbers movieclips with the frames of the imagery making up
// the numbers of 0-9.
for(movie in this){
if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
}
};
// this function is a MovieClip.prototype meaning its available to be used by
// all movieclips. It's a sneaky function that saves a lot of work by using
// name each numbers movieclip in the counter movieclip to determine which value
// it needs to display based on the times derived from the previous
// calculations of the onEnterFrame. What it does is seperates a movieclip's
// _name into a variable word and a number. The variable word will represent
// the variable to look up a value for in the passed variableClip and the
// number will be used to get a character from that value (a string) which
// represents which number this movieclip should display.
MovieClip.prototype.evaluateFrameFrom = function(variableClip){
// split this _name into an array of 2 values seperated by an underscore
var nameArray = this._name.split("_");
// the first value represents what variable in variableClip (counter clip)
// this movieclip is used to represent whether it be mins or hours etc.
var numberSet = variableClip[nameArray[0]];
// next a number representing which character in that first value this
// movieclip should display. this will be between 0 and 2 (any one of
// three values). number() is used to force it to be a number value.
var character = number(nameArray[1]);
// a frame number can then be derived from the value of the numberset
// variable based on the character defined by character. number() is
// used to force it to a number value and 1 is added to offset the
// frame value by one since 0 is at frame 1 and 1 at frame 2 etc.
var frame = 1 + number(numberSet.charAt(character));
// if the movieclip is not already at the frame, move it there!
if (this._currentframe != frame) this.gotoAndStop(frame);
};
// an example of the above function in action would be for a movieclip
// with the name "days_1". days_1 is seperated into an array by dividing
// the name by its "_" character giving "days" (nameArray[0]) and "1" (nameArray[1]).
// The value of days is then retrieved from the passed variableClip using
// associative array ssntax and is set to numberset. The value of days in variableClip
// would be a string something along the lines of "045". character is then used
// to get which of those 3 values this movieclip is to represent. It is just
// nameArray[1] turned into a number or "1" to 1. So, charAt(1) of "045" would
// be 4. Turn that into a number and add one and you get frame 5 where the image of
// the 4 is located. The movieclip, days_1, is then played to that frame to show it.
I don't see how to set the date I'm counting down to. I know it's set to christmas this year, but how do I change it? (btw if it's set to christmas this year then why the heck is it 11, 25 instead of 12, 25?)
Date Countdown Script
Does anyone have a script to countdown to a date and time? I've tried the usual resources and can't seem to find anything? Any help would be much appreciated.
llama.
Countdown Timer For Date And Time
I am trying to make a countdown timer and I dont know how to make the date count down. Can someone help me correct my script. Help would be greattly appricieated.
This is my script:
// GetDate Mechanism
myDate = new Date();
seconds = myDate.getSeconds();
minutes = myDate.getMinutes();
hours = myDate.getHours();
days = myDate.getDay();
seconds2 = 59-seconds;
minutes2 = minutes-11;
hours2 = 13-hours;
// I am wondering what this is for. Please help???
if (length(minutes2) == 1) {
minutes2 = "0"+minutes2;
}
if (length(seconds2) == 1) {
seconds2 = "0"+seconds2;
}
// Information To Textbox
hoursLeft = (hours2);
minsLeft = (minutes2);
secsLeft = (seconds2);
Setting Date/time Countdown
I know how to set the date and time in flash of someone's computer when the swf loads. but what i want to do is set a destination time...say, next friday, 5/3/02, so when a user opens the html page flash will read their date and time and determine how many hours and minutes there will be till 5/3/02 and display it. hope that makes sense and someone can help. Thanks!
Flash 5 Date Countdown Timer
Can anyone help? i've looked everywhere (with no luck) to try and find help on creating a countdown timer to a specific date and time in flash 5. in this format..
30days 12hours 15mins 39secs until armageddon
Countdown Timer - Date From .txt File?
Hey,
Im making a countdown timer, using the following actionscript:
Code:
stop();
currentDate = new Date();
thisYear = currentDate.getFullYear();
eventDate = new Date(2006, 11, 25);
eventMillisecs = eventDate.getTime();
counter.onEnterFrame = function(){
currentDate = new Date();
currentMillisecs = currentDate.getTime();
this.msecs = eventMillisecs - currentMillisecs;
if (this.msecs <= 0){
play();
return;
}
this.secs = Math.floor(this.msecs/1000); // 1000 milliseconds make a second
this.mins = Math.floor(this.secs/60); // 60 seconds make a minute
this.hours = Math.floor(this.mins/60); // 60 minutes make a hour
this.days = Math.floor(this.hours/24); // 24 hours make a second
this.msecs = string(this.msecs % 1000);
this.secs = string(this.secs % 60);
this.mins = string(this.mins % 60);
this.hours = string(this.hours % 24);
this.days = string(this.days);=
while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
if (this.secs.length < 2) this.secs = "0" + this.secs;
if (this.mins.length < 2) this.mins = "0" + this.mins;
if (this.hours.length < 2) this.hours = "0" + this.hours;
while (this.days.length < 3) this.days = "0" + this.days;
for(movie in this){
if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
}
};
=
MovieClip.prototype.evaluateFrameFrom = function(variableClip){
var nameArray = this._name.split("_");
var numberSet = variableClip[nameArray[0]];
var character = number(nameArray[1]);
var frame = 1 + number(numberSet.charAt(character));
if (this._currentframe != frame) this.gotoAndStop(frame);
};
And was wondering if it is possible to adapt this code to draw the target date from an external .txt file so that the timer can be updated without having to export the flash file again.
Many Thanks.
Countdown Timer Target Date
Hi,
I'm trying to set up the great countdown timer used in the tutorial here, and it's working great, except for one thing:
I can't seem to be able to correctly set a time in addition to the date. When I just set a target date, all is well, but when I try to set an actual time within that date, the timer jumps to it's completion when run.
I think maybe I'm just not understanding the format needed:
Code:
// Date( year, month-1, date [, hour [, minute [, second [, millisecond]]]])
eventDate = new Date( 2004, 05, 12);
Can someone please show me an example of how to enter, say, June 12th 2004 at 8:00 am? This must be pretty obvious, but I'm obviously missing something here (I'm a beginner when it comes to flash).
Thanks in advance!
Countdown Problem To Date Next Year
I have followed the tutorial (http://www.kirupa.com/developer/mx/countdown2.htm) to countdown to Christmas day. However I want to count down to a date in Feb next year.
How could I modify the code I have already (posted below) to be able to do this. I am fairly new to flash programming so am unaware of the syntax.
// first get this current year so this example
// remains valid for some time to come
currentDate = new Date();
thisYear = currentDate.getFullYear();
// define the event date counting down to
// this is constant so it won't need to be
// calculated in the onEnterFrame function below
// currently counting down 'til christmas of 2003
// Date( year, month-1, date [, hour [, minute [, second [, millisecond]]]])
eventDate = new Date(thisYear, 01, 01);
eventMillisecs = eventDate.getTime();
Any help is greatly appreciated, thanks
Question About Date Countdown Timer
I have downloaded the fla for the Date Countdown Timer and I think it is awesome.
I would like to just countdown for 15 minutes, so what do I need to change in the code to get rid of the days and hours, and just use the minutes seconds and milliseconds?
thank you,
Greg
Countdown Timer - Set Date With PHP Script
Hello, I did some site searches but didn't see any posts on this, but did find an excellent princess bride quote thread. I also have been looking at many walkthroughs on inserting php into flash actionscript, but can't seem to get what I want working.
This countdown from: http://www.kirupa.com/developer/mx/countdown.htm
is great, and will fit our needs.
Code:
// define the event date counting down to
// this is constant so it won't need to be
// calculated in the onEnterFrame function below
// currently counting down 'til christmas of 2003
// Date( year, month-1, date [, hour [, minute [, second [, millisecond]]]])
eventDate = new Date(2003, 11, 25);
I replaced 2003, 11, 25 with server.year server.month server.day
In the gettime.php I added:
Code:
<?php
echo "time=" . time();
$year = "2007";
$month = "11";
$day = "4";
$hour = "05";
$minute = "21";
print("&year=$year");
print("&month=$month");
print("&day=$day");
print("&hour=$hour");
print("&minute=$minute");
?>
I will replace the values with a value from a form post in a different page, but want to see if the values from php will go to the swf.
It just creates a blank swf. I really like the countdown timer as is, but just want an input page for others to be able to submit a new time to count down to.
Thanks for any input.
Date Countdown Timer With Variables?
I've tried this tutorial about timers, and I everything work out just fine.
The one problem is that I want to be able to alter the date
its counting down to, and I have no clue how to do that....
I've tried to put variables in the newDate but that doesn't work, is there a way to do this, or is it just impossible?
Countdown Clock To Specific Date
Hi, i'm extremely new to flash but I"m creating a website and I want to countdown to my birthday, or any other date for that matter. I have found some countdown clocks but the problem is that the design is soo ugly.
In my mind I picture big fluorescent pink letters, slightly embossed. Is there some way to create a countdown clock similar to that of like a basketball clock/shot clock for example
50.03 = 50min 03secs
so it would look similar to this but only in big fluorscent pink letters
360.50.20.59
which is hours.minutes.seconds.milliseconds
Thanks in advance!
Kirupa's Date Countdown Timer Tutorial
Hi,
I've just implemented Kirupa's countdown timer as seen at http://www.kirupa.com/developer/mx/countdown.htm
This uses the client's system time as a basis for the date calculation. I'm wondering if anyone has implemented this countdown timer using server time instead of client time with say PHP?
Thanks
Changing A Date To Next Year In A Countdown Timer
I am trying to make a countdown timer and am using this code:
// first get this current year so this example
// remains valid for some time to come
currentDate = new Date();
thisYear = currentDate.getFullYear();
eventDate = new Date(thisYear, 11, 25);
eventMillisecs = eventDate.getTime();
This works great for countig down to the end of this year, but I want to modify it to countdown to a date next year 04-28-06. How can I change this to get it to work....
Thanks, Marc
Date Countdown Timer: Specify Time Zone.
Hi.
I've been using your tutorial for a date countdown timer with great sucess, although now I realise because it took the date from the computer that is viewing it and because the event is counting to an event in India, it would be wrong because up until now, ive just put the date and time so obivously it would be wrong because it would be that time/date of that timezone. Is there anyway I can alter the actionscript for a specific timezone?
Thanks very much for your help.
Flash Countdown Ticker Using Server Date
Hi,
I am making a countdown ticker that would get the current server date & time and then calculate the remaining time from a target date.
I am using a PHP file to output the current server date & time. Then I use the Flash's loadvars function to get the result and format it as a Date field. However, when I trace for remaining days using targetDate-serverDate, I get NaN as the result.
Any help will be greatly appreciated. Below is the code for my flash script as well as the php script.
Flash Code:
Code:
onClipEvent (load) {
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("http://localhost/getServerDate.php");
// once vars have been loaded:
myVars.onLoad = function(success) {
if (success) {
for (var prop in this) {
var nowDate:Date = myVars.serverDate;
}
} else {
trace(" Error loading variables ");
}
// trace (nowDate);
target_date = new Date(2008, 3, 29, 13, 20, 59);
days = Math.floor((target_date-nowDate)/1000/60/60/24);
trace (days);
};
}
PHP Code:
Code:
<?php
// Set default timezone
//date_default_timezone_set('Asia/Calcutta'); // for PHP5
putenv("TZ=Asia/Calcutta"); // for PHP 4
$now = date("Y, n, j, G, i, s");
print "&serverDate=$now&";
?>
Thanx in advance,
Sridhar
www.signature.co.in
Change Countdown Clock Date [renamed]
Hello there,
I was able to figure out how to change the Countdown Clock date but I seem to be falling in a jam and hope someone can help me. On the Action Script countdown clock I would like to change the time (hrs, ex: date is set to 12/19/08 but the time needs to be 8pm). Can someone please tell me how to change the time?
Below is my action script
Thanks in advance!
this.onEnterFrame = function() {
var todayDate = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var targetDateDate = new Date (currentYear,11,19);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
var sec = Math.floor (timeLeft/1000);
var min = Math.floor (sec/60);
var hrs = Math.floor(min/60);
var days = Math.floor(hrs/24);
sec = string (sec % 60);
if (sec.length < 2){
sec = "0" + sec;
}
min = string(min % 60);
if (min.length < 2){
min = "0" + min;
}
hrs = string(hrs % 24);
if (hrs.length < 2){
hrs = "0" + hrs;
}
days = string(days);
var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
time_txt.text=counter;
}
|