This content has been marked as final. Show 9 replies
it shouldn't be hard to create a new date object based on that string, you can then calculate the Date 30 days earlier and then compare it to the current date, if those match send you message.
The problem I see is how to be sure that the user visits the site at exactly thet date, or at all?
And as you need server side scripting anyhow, why not do it all in e. g. PHP instead of Flash?
thanks for the reply.
You are right, what happens if he enters on day 29 before expire date, - nothing will happen.
So what I need actually - how many days are there from today until "expireDate"?< and this must be a number.
Then I could say,
if this number <= 30/ send my first warning.
if this number <= 15/ send my second warning.
But no idea, how can I get this number from today until "5/21/2007"
Will try to find it somewhere. Maybe NSurveour has written something before or do you know?.
why dont you try this
var expdate:Date = new Date(2006, 8, 1);
var current:Date = new Date();
if ((current-expdate)/(1000*3600*24)) < -30
//minus mean current date is less that expiredate
// put your action here
it is better to do this on the server side not on the client side
this looks not bad, but...
the problem is, I get a String in like "4/20/2007"
- how do I convert this String, so I can put it in here>
var expdate:Date = new Date(2006, 8, 1); <<<<
var str = "4/20/2007";
var a = str.split('/');
var myDate = new Date(Number(a),Number(a),Number(a));
Thank you abeall,
this is also good, it returns now
Sun May 20 00.00.00 GMT+0800 2007
but.... now from current date to this date -
can I find out, how many days?? so I can reach my target to send my reminder 30 days before expire date??
Hi, to All,
unfortunately still I could not get the solution for my problem.
I have 2 strings coming in from a Database.
todayDate = "9/7/2006";
expireDate = "4/20/2007";
// now, I could find the difference in months with the code below>
aDate = todayDate;
bDate = expireDate;
TimeUsed.text = monthsBetween(toDate(aDate),toDate(bDate));//<<will be "7"
var d_arr = str.split('/');
return new Date(d_arr,d_arr,d_arr);
var d_date = new Date(d1.valueOf());
var t_date = new Date(d2.valueOf());
var m = -1;
//This will return me the difference between the 2 date strings in months, great, but can I get the d a y s between??
Thank you for your help.
so stuck on your question i think you've missed that its already been answered! so i've compiled it into one place for you:
thank you very much, yes this did the job.
Now I have 226, the difference in days, great,
how stupid I am.
Thanks to all.