Calculating Elapsed Time ActionScript

by Nathan 27. July 2009 09:58

 

function calculateTimeElapsed(startTime:Date,endTime:Date) {
    
    var sHours = startTime.getHours();
    var sMinutes = startTime.getMinutes();
     var sSeconds = startTime.getSeconds();
    var sMilliSeconds = startTime.getMilliseconds();

    var eHours = endTime.getHours();
    var eMinutes = endTime.getMinutes();
     var eSeconds = endTime.getSeconds();
    var eMilliSeconds = endTime.getMilliseconds();
    
    var sTimeSpan = (sHours*3600*1000) + (sMinutes*60*1000) + (sSeconds*1000) + (sMilliSeconds);
    var eTimeSpan = (eHours*3600*1000) + (eMinutes*60*1000) + (eSeconds*1000) + (eMilliSeconds);
    return eTimeSpan - sTimeSpan;
    
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Flash

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

I am a Website Developer and Designer based in Sydney, Australia. I have experience in developing websites and applications using various languages including C#, VB, C++, Flash (ActionScript), SQL and Linux. You can see some of my projects at www.nathanbaker.com.au

Page List