Skip to main content
saratogacoach
Inspiring
May 8, 2013
Answered

30 day expiration date

  • May 8, 2013
  • 1 reply
  • 871 views

Hi,

I'm trying to create a 30 day expiration date for an action.

Start by getting the date on a specific starting date.

var D1:Date = new date;

Add 30 days:

D1.date += 30;

Set up a getDate function:

var D2: date = new date;

How do you compare D1 and D2 as date (not numbers) to check if D2 is more than 30 days greater than D1? Will this work? For example, if today is May 8, then +=30 would be June 7. How to compare that if a date is gotten on June 9, and compared with a stored (SO, for example) May 8, that it is greater (then do something condition)?

if ( D2 > D1) {

//do something

}

Any help appreciated.

saratogacoach

This topic has been closed for replies.
Correct answer Ned Murphy

Search Google using "AS3 compare dates" and you should find what you need

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
May 8, 2013

Search Google using "AS3 compare dates" and you should find what you need

saratogacoach
Inspiring
May 8, 2013

Hi Ned,

OOPS. I had searched, but I must not have used the correct search terms. When, following your advice plus specifically using "AS3 compare dates," I searched again, several items showed up.

The first: http://userflex.wordpress.com/2008/09/11/as3-date-compare/ looks promising. I'll see if I can figure it out.

If I run into a problem, I'll write again.

Much thanks.

saratogacoach