Time Over 24 Hours

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vicyankees@gmail.com

    Time Over 24 Hours

    I am creating a report that has call duration and if i run it over a
    multi-day span the duration is limited to 24 hours and starts over at
    zero. is there a way to not limit hours?

    I am usign the following in my select statement:

    convert(varchar (12), dateadd(s,
    SUM(ISNULL(Call s.OutgoingCallD uration,0)), '19900101'), 108) AS
    [Outgoing Call Duration]

  • markc600@hotmail.com

    #2
    Re: Time Over 24 Hours


    Rather than using CONVERT, you can get the number
    of hours, minutes and seconds using this

    Hours = OutgoingCallDur ation / 3600
    Mins = (OutgoingCallDu ration % 3600) / 60
    Seconds = OutgoingCallDur ation % 60

    Your statement will end up like this

    RIGHT('00'+CAST ((SUM(ISNULL(Ca lls.OutgoingCal lDuration,0))/3600) AS
    VARCHAR(2)),2) +
    RIGHT('00'+CAST (((SUM(ISNULL(C alls.OutgoingCa llDuration,0)) % 3600) /
    60) AS VARCHAR(2)),2) +
    RIGHT('00'+CAST ((SUM(ISNULL(Ca lls.OutgoingCal lDuration,0)) % 60) AS
    VARCHAR(2)),2)

    You may find it more efficient to do this in your front end

    Comment

    • Martijn Tonies

      #3
      Re: Time Over 24 Hours

      > I am creating a report that has call duration and if i run it over a[color=blue]
      > multi-day span the duration is limited to 24 hours and starts over at
      > zero. is there a way to not limit hours?
      >
      > I am usign the following in my select statement:
      >
      > convert(varchar (12), dateadd(s,
      > SUM(ISNULL(Call s.OutgoingCallD uration,0)), '19900101'), 108) AS
      > [Outgoing Call Duration][/color]


      There _is_ no time over 24 hours.

      Think of the problem differently: you're trying to put a _duration_ into
      a place that only allows _time_ values. That's not going to fit. Well,
      yeah, it fits if the duration is below the length of 24 hours, but that's
      it.

      Now, given that, a "duration" could never be the same as a "time"
      (eg: 01:23 PM).


      --
      Martijn Tonies
      Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
      MS SQL Server
      Upscene Productions
      Upscene: Database tools for developers. Database tools for Oracle, PostgreSQL, InterBase, Firebird, SQL Server, MySQL, NexusDB, SQL Anywhere and Advantage Database. Auditing tools for databases. Test Data Generator tools for databases.

      My thoughts:

      Database development questions? Check the forum!



      Comment

      • --CELKO--

        #4
        Re: Time Over 24 Hours

        Events need to be modeled as start and finish timestamps. You can then
        easily compute the number of minutes or whatever unit you wish from
        those two columns.

        Comment

        Working...