Hello to who is reading this post!
I have tried to calculate the time in years between two time var's as fallows..
.. the logic made sense, but the tests showed something else.
Do you have any suggestions how to solve this question.
Thank you in advance!
Herendi Kristóf Pál
Your logic seems good to me.The below code gives me 1 year, as expected.
var milliSecondsPerDay:uint = 1000 * 60 * 60 * 24;
var SomeDate:Date = new Date(2008,11,31,20,45,0,0);
var Now:Date = new Date();
trace ((Now.getTime() - SomeDate.getTime())/(365*milliSecondsPerDay));
There should be a method in the open source DateUtils class that can be used for calculating the length of time between two date variables:
The library is great; I've used some parts of it extensively while building the Flextras Calendar Component.