0

I've been searching this for weeks and have tried many things on my own, so if there's a simple answer, I'm prepared to kick myself for it :)

I want my user to input a date in the past. Then, I want to compare that date with today's date and spit out the difference in years, months, and days (i.e. "It has been 3 years, 6 months, and 2 days since...").

Everything I'm finding online will figure out just the days or milliseconds. I tried to write my own class that figures out the years (totalNumberOfDays/356) and the months, but I run into an issue with leap years. Is there a class out there that already does this?

Thanks for any help and/or point in the right direction!

Tony

Tony
  • 45
  • 8
  • There is a similar question for javascript here: http://stackoverflow.com/questions/17732897/difference-between-two-dates-in-years-months-days-in-javascript actionscript should be very similar if not identical. – Octopus Dec 10 '14 at 22:03
  • Thanks Octopus. That's fairly similar to the class I wrote. I'll post my code a little later today with some adjustments. Thanks! – Tony Dec 10 '14 at 22:21
  • 1
    Tony, look at the `Date` class and this question: http://stackoverflow.com/questions/3106387/how-to-do-flex-date-deduction-and-addition – Brian Dec 10 '14 at 23:05

0 Answers0