Trying to format datediff Hours, Minutes, Seconds
Posted on 2004-08-19
I track the date and time a user enters a site and leaves. I obtain the Hours, Minutes and Seconds with the following code:
LoggedTimeHours = datediff("h", request.Cookies("TimeIn"), now())
LoggedTimeMinutes = datediff("n", request.Cookies("TimeIn"), now())
LoggedTimeSeconds = datediff("s", request.Cookies("TimeIn"), now())
It gives me results such as... 0 : 4 : 190 (Hours:Minutes:Seconds).
For longer Times I've also Noticed that the minutes can be in the hundreds and the seconds in the thousands.
I'm guessing that this is because what it is giving is the TOTAL number of hours/minutes/seconds between the two dates.
Does anyone have a reliable routine to break down the three numbers to show the time that has passed, (ie. 1 Hours : 2 Minutes : 45 Seconds), instead of the total number of each?