public static function getDaysBetweenDates(date1:Date,date2:Date):int { var
one_day:Number = 1000 * 60 * 60 * 24 var date1_ms:Number = date1.getTime();
var date2_ms:Number = date2.getTime(); var difference_ms:Number =
Math.abs(date1_ms - date2_ms) return Math.round(difference_ms/one_day); }

On Tue, Oct 13, 2009 at 12:48 PM, ACE Flash <acefl...@gmail.com> wrote:

> Hi there, I am using the date class in flash as3, I was wondering how to
> compare two date and return how may days left.
>
>
> for instance: my target date is 10/18/2009(mm/dd/yyyy), I would like to
> compare with the current date 10/13/2009, the script returns 5.
>
> something like....
>
> var localDate:Date = new Date();
> var day:Number = localDate.getDay();
> var month:Number = localDate.getMonth();
> var year:Number = localDate.getFullYear();
>
>
> var currentDate:Date = new Date ( year, month , day )
> var targetDate:Date = new Date ( 2009 , 10 ,18 );
>
>
> trace(currentDate - targetDate)
>
>
> Thank You
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
http://ericd.net
Interactive design and development
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to