PDA

View Full Version : Increment date?


Jood
11-26-2003, 05:40 PM
Hi,
I'm using flash MX and I'm trying to make something which will:
1. display the current date (dd/mm/yyyy)
2. the date plus 1 day on a button press (dd/mm/yyyy)

(I've worked out how to do the first part.)

Basically I want to make it so that the user can keep pressing the button until they get to a date they want (I know this is a stupid way to do it but I'm only doing what I'm told). If only there was date++ :rolleyes:

If anyone can help me with this I'd be really grateful.
Thanks in advance.

freddycodes
11-26-2003, 11:26 PM
Well actually there is. But you need to convert the date to microtime first. If "c" was the instance name of our button.


d = new Date();
showTime();
function showTime()
{
trace ((d.getMonth() +1)+ "/"+d.getDate()+"/"+d.getFullYear());
}
function incTime()
{
var foo = d.getTime()/1000;
d.setTime((foo+86400)*1000);
showTime();
}
c.onRelease = function() { incTime(); }

Jood
11-27-2003, 09:35 AM
Thank you! :cool: