tags:

views:

179

answers:

2

hey all,

im really new to flash, how do i go about creating a variable which will get the current date and time and add 30 minutes to it ?

thanks

+2  A: 

This should do the trick.

var min:Number = 30;
var mSecs:Number = min * 60 * 1000;
var sum:Number = mSecs + date.getTime();

var newTime:Date = new Date(sum);

You can see some examples of turning this into functions you can reuse as well on Adobe's livedocs website.

Shawn Steward
A: 

This gets today's date and adds 30 minutes to it.

var mydate:Date = new Date();
mydate.setMinutes(mydate.getMinutes() + 30);
enduro
according to the flash docs, setMinutes() can't accept anything larger than 59, so it's likely you'll have an error if you pass an hour mark.
UltimateBrent