Posted By

FlashJunior on 08/06/08


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

THEPWN3R
dx0ne
chchrist
Pingpongbal


Get difference between two dates in days


 / Published in: ActionScript 3
 

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

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: xxdesign on November 3, 2009

Thanks . How do I use this code?

Posted By: logingue on July 13, 2011

Thank you, it's useful.

You need to login to post a comment.