In ActionScript 3.0, is there an automatic way to calculate the number of days, hours, minutes and seconds between two specified dates?
Basicly, what I need is the A
for some a single function like this my be preferable... [condensed from Richard Szalay's code]
public function timeDifference(startTime:Date, endTime:Date) : String
{
if (startTime == null) { return "startTime empty."; }
if (endTime == null) { return "endTime empty."; }
var aTms = Math.floor(endTime.valueOf() - startTime.valueOf());
return "Time taken: "
+ String( int(aTms/(24*60*+60*1000)) ) + " days, "
+ String( int(aTms/( 60*60*1000)) %24 ) + " hours, "
+ String( int(aTms/( 60*1000)) %60 ) + " minutes, "
+ String( int(aTms/( 1*1000)) %60 ) + " seconds.";
}