Skip to Content
Former Member
Nov 08, 2011 at 08:28 PM

Converting Date/Time to Seconds


I have a report where I need to calculate the Avg Logged-In Time for a rep.

I got to the part where I take their log-in and log-out information to calculate the Logged-In duration. Now I need to add the duration and then divide it by the number of log-Ins.

Converting to Seconds- @ AgentstateTime

tonumber(left(totext(left(totext(time({@GMTTOCST}),"HH:mm:ss"),8)),2))3600+ tonumber(mid(totext(left(totext(time({@GMTTOCST}),"HH:mm:ss"),8)),4,2))60+ tonumber(right(totext(left(totext(time({@GMTTOCST}),"HH:mm:ss"),8)),2))



LOG Duration AgentStateTime

Logged out 48 48577

Logged in 31 48,625

Logged out 27 48,656

Logged in 324 48,683

Logged out 22 49,007

I would like to add the duration field where LOG=Logged in then divided by the number of sessions.

(31+324) /2

My problem is it does not let me do a sum or a running total on the "Duration" field. Is there another way of achieving the same result?

Appreciate any help!