how do you calculate elapsed time?

Results 1 to 4 of 4

Thread: how do you calculate elapsed time?

  1. #1
    Join Date
    Dec 1969
    Posts
    144

    Default how do you calculate elapsed time?

    here is my problem:<BR>user clicks on an asp page, then 2 minute and 44 seconds later the user clicks a link out of the page. How do you calculate how long the user was on the first page and write the calculated time to the second pag?<BR>Please help?<BR>Thanks,<BR>Ray

  2. #2
    Sam Otto Guest

    Default RE: how do you calculate elapsed time?

    If the second page is not an ASP on your site, you&#039ve got a problem.<BR><BR>I guess you could wait for the Session to time out and capture the last time in the Session_OnEnd in global.asa and subtract the Session timeout value...

  3. #3
    Join Date
    Dec 1969
    Posts
    144

    Default RE: how do you calculate elapsed time?

    the second page is an asp page

  4. #4
    Chris Willey Guest

    Default RE: how do you calculate elapsed time?

    You can do the whole thing in Javascript:<BR><BR>function startTime() {<BR>stTime = new Date();<BR>stMsec = stTime.getTime();<BR>}<BR><BR>function endTime() {<BR>endTime = new Date();<BR>endMsec = endTime.getTime();<BR>totalSec = parseInt((endMsec - stMsec)/1000);<BR>}<BR><BR>Make startTime() happen with the body onload event handler, and call endTime() either on body onunload or in a hyperlink. You can pass the variable totalSec to the next page a number of ways, and interpret it there (either with asp or Javascript). You&#039ll need to convert totalSec to minutes and seconds (it will just be in seconds).<BR><BR>Hope this helps.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •