How to calculate Response time in HH:MM:SS format ?

Hi,
How can we calculate reponse time in HH:MM:SS format?
I have tried this formula but doesnt really seems to be providing desired output
CAST (FLOOR (TIMESTAMPDIFF (SQL_TSI_HOUR, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) /24) as CHAR) || ' Days, ' || CAST (FLOOR((TIMESTAMPDIFF (SQL_TSI_MINUTE, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) - FLOOR (TIMESTAMPDIFF (SQL_TSI_HOUR, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) /24) *1440)/60) as CHAR) || ' Hours, ' || CAST (TIMESTAMPDIFF(SQL_TSI_MINUTE, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) - (FLOOR (TIMESTAMPDIFF (SQL_TSI_HOUR, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) /24) *1440) - (FLOOR((TIMESTAMPDIFF (SQL_TSI_MINUTE, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) - FLOOR (TIMESTAMPDIFF (SQL_TSI_HOUR, "Service Request"."Opened Date and Time" , "Service Request"."Closed Date and Time" ) /24) *1440)/60)*60) as CHAR) || ' Minutes'
Output for this formula :
Opened Time Closed Time Response Time
16/10/2008 08:50:00 21/10/2008 11:33:21 5 Days, 2 Hours, 43 Minutes
16/10/2008 08:57:00 24/10/2008 15:17:38 8 Days, 6 Hours, 21 Minutes
16/10/2008 09:55:00 27/11/2008 10:44:36 42 Days, 0 Hours, 50 Minutes
16/10/2008 10:13:00 21/10/2008 13:53:38 5 Days, 3 Hours, 41 Minutes
16/10/2008 11:18:00 20/10/2008 09:11:29 3 Days, 21 Hours, 53 Minutes
I just need time difference between Closed Time and Open time in HH:MM:SS format.
Regards
Ahmed

WITH m AS
  SELECT [Minutes] = CAST(21.52 * 60 AS int)
SELECT CAST([Minutes] / 60 AS varchar) + ':' + RIGHT(100 + [Minutes] % 60, 2)
FROM m
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • How to calculate the time between start trigger,first scan and first A/D in DAQ

    Environment: Labview 6.1, N6052E DAQ board(max scan rate=333KHz, max channel rate=333KHz, settling time=3.5usec+1LSB)
    I am using external scan clock 10K scan/s collecting data on 16 AI channels, and external channel clock 200KHz.
    Could show me how to calculate the time betweent he start trigger, the first scan and the first A/D conversion?
    Thanks

    I read the one you give to me. still cannot work out. I am using Labview 6.1 DAQ vi, including AI config.vi. clock config.vi, AI control.vi, AI read.vi, working on colect data on 16 AI channels. So I belong to SCAN function and external scan and sampling timing, right?
    But it says the T1 and T2 are determined by external signals. How can I calculate that?
    T1=1/10KHz or T1=1/160Khz?
    T2=1/200KHz?
    Is the above correct?

  • How to enhance response time on select?

    I'm using ibatis/mySql in my struts application and apparently the response time to receive data (select) is quite long.
    I'm referring to a select statement to receive data from 5 diff tables (~6 column each). there are 500 objects (Cars) and it takes around 63 seconds (my computer has 2GB Ram).
    can someone advise how to enhance the response time.
    thanks

    yes, they all have primary keys and indexes.
    Do you do the JOIN in the database or are yougetting a ResultSet and then iterating over it to
    SELECT the rest? (This will kill you with network
    traffic.)
    yes I'm using the select with no join.
    I'm using abator to auto-generate the sql statements
    and therefore I loop on every car'd id and get my
    releven info. so basically it's all select after
    select and integrate them in the car object. That's the reason then: If your outer select returns N rows, you're doing N network roundtrips to get the rest of the data. It's a certain performance killer.
    is there major diff between reading one by one oever
    reading everything in one go? meaning right now i do
    this:
    get list of all car_idNetwork roundtrip #1
    iterate through db with car_id and construct a CAR object...Which means one round trip per row. You're dead in the water here, no matter how you optimize the database.
    add object to LinkedList move to the next car...Rewrite that query and bring all the data back in one network roundtrip. You'll notice an immediate improvement.
    %

  • How to calculate elapsed time based on user input

    I'm not sure what to do next in this program. Basically, I'm not sure exactly how to get the time to output accurately, as in what forumla I should be using.
    This is the question:
    What comes 13 hours after 4 o'clock? Create an ElaspedTimeCalculator application that prompts the user for a starting hour, whether it is am or pm, and the number of elapsed hours. The application then displays the time after that many hours have passed. Application output should look similar to:
    Enter the starting hour: 7
    Enter am or pm: pm
    Enter the number of elapsed hours: 10
    The time is: 5:00 amHere's the code I have so far:
    import java.util.Scanner;
    public class ElapsedTimeCalculator
         public static void main(String[] args)
              int starting_hour;
              int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
              String am_or_pm;
              int elapsed_hours;
              int elasped_minutes;
              int time_hours;
              int time_minutes;
              System.out.println("Welcome. This application will give you the time based on your input.");
              System.out.println(" ");
              Scanner input = new Scanner(System.in);
              System.out.print("Enter the starting hour: ");
              starting_hour = input.nextDouble();
              System.out.print("Enter the starting minutes: ");
              starting_minutes = input.nextDouble();
              System.out.print("Enter either 'am' or pm': ");
              am_or_pm = input.nextString();
              System.out.print("Enter the number of elapsed hours: ");
              elapsed_hours = input.nextDouble();
              input.close();
              time_hours =
              time_minutes = 
              if(am_or_pm = "am" || am_or_pm = "a.m." || am_or_pm = "AM" || am_or_pm = "A.M.")
                   System.out.println("The time is " + time_hours + ":" + time_minutes + "am");
              if(am_or_pm = "pm" || am_or_pm = "p.m." || am_or_pm = "PM" || am_or_pm = "P.M.")
                   System.out.println("The time is " + time_hours + ":" + time_minutes + "pm");
    }To calculate time_hours should I just calculate this by adding the elapsed hour to the starting hour? I doubt it will be accurate for all situations.
    Same for the time_minutes For example, if the starting minutes and the elapsed minutes were 50, it would be greater than 60. Also, not sure if it makes sense to separate hours and minutes like this, it's not required to in the question. I initally thought it would be easier to approach like this instead of allowing the user to input a double for the starting hour. ex. 5.7
    I get the feeling that this is extremely simple, but nonetheless, I'm stuck, so any help would be appreciated.

    Well thanks to both of you. I did a little reading up on the modulus operator and coupled it with some logic (although, truthfully, I'm not really using to there actually being an application for the remainder of a division operation, since it's never really used very much in any of my Math courses) and the hours portion works perfectly now:
    import java.util.Scanner;
    public class ElapsedTimeCalculator
         public static void main(String[] args)
              int starting_hour;
              //int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
              String am_or_pm;
              int elapsed_hours;
              //int elasped_minutes;
              System.out.println("Welcome. This application will give you the time based on your input.");
              System.out.println(" ");
              Scanner input = new Scanner(System.in);
              System.out.print("Enter the starting hour: ");
              starting_hour = input.nextInt();
              //System.out.print("Enter the starting minutes: ");
              //starting_minutes = input.nextInt();
              System.out.print("Enter either 'am' or pm': ");
              am_or_pm = input.next();
              System.out.print("Enter the number of elapsed hours: ");
              elapsed_hours = input.nextInt();
              input.close();
              int time_hours = 0;
              //int time_minutes;
              String meridien;
              if(am_or_pm.equals("am"))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("am"))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("AM"))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("A.M."))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("pm"))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("p.m."))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("PM"))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("P.M."))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              if(time_hours < 12)
                   meridien = "A.M.";
                   System.out.println("The time is: " + time_hours + ":00 " + meridien);
              else if(time_hours > 12)
                   meridien = "P.M.";
                   System.out.println("The time is: " + time_hours + ":00 " + meridien);
    }Now the only thing is the minutes. My teacher did say she wants the user to have the option to input minutes also if he/she desires, so I do need it. However, the only problem is that if say the user inputs a "starting minute" of 14 for example, and 66 minutes elapsing, then (14 + 66) int/ 60 = 1r20 but using the modulus operator would only give me 20. So how will I be able to add any extra hours if it is necessary?

  • How to view response time for each execution in OEM 12c Cloud Control

    Hi All,
    I want to view response time of each execution for my SOA composite in OEM 12c Cloud Control. Can anyone tell me how can I achieve that?
    Thanks in Advance!!

    You should open an SR and support can assist you with it. The only current case where that feature is known to not work is in the case where the Dehydration Store is running on RAC. Otherwise, it should be possible to get it to work. The main thing is that you need to have DB configuration properties (host, port, sid) that have a 3-way string match between the JDBC data source configuration in the WLS server, the JDBC properties you add to the Monitoring Properties of the SOA Infrastructure target, and the connect settings of the Database target in EM that matches to the dehydration DB.
    If there isn't a match in all 3, the Dehydration Diagnostics page will not work. But again, to look into your specific setup, you should file an SR and work with support.

  • How to calculate Execution Time

    Hi gurus,
    Can any one tell me how to calculate the Report Execution time in Seconds.
    We have one requirement.My manager told me track all the reports in Development server how much time those take to execute. and Compare those with Production server.
         I dont have an Idea how to calculate the Execution time in Seconds.
    Please guide me on this.
                    Thanks in Advance
    Thanks and Regards
    Siri...

    hi
    check se30
    enter the prog name and press execute.
    after your execution is over press back
    then press evaluate in the initial screen.
    you have the analysis
    in that you will get the time in microseconds and you can convert to sec
    REWARD IF HELPFUL
    PRASANTH

  • How to calculate SELECT time

    I want to know how to calculate time taken by SELECT query.
    For example: I am running one select statement in TOAD(oracle version 9i) which takes 40 seconds to run but in output window it display few records. It says "showing 1 of 500 records, more records exist". That table has total 20 million records.
    Now my question is: Did my SELECT query took 40 seconds? or it took 40 seconds to SELECT 500 records.
    If it took 40 seconds to SELECT 500 records then how to calculate total amount?
    Any help would be very much appreciated.

    Where I will find trace file?
    Toon Koppelaars wrote:
    What you could do is this.
    Say your current query is Q1. Then instead of executing Q1 in toad execute this in Toad:
    select count(*)
    from (Q1)
    /This is not totally safe, since the CBO could decide to alter the execution plan given that you now are not interested in any of the columns you had in the SELECT list of Q1.
    Other alternative is to use sqlplus.
    Set pages 0
    alter session set sql_trace=true;
    Run your Q1.
    alter session set sql_trace=false;
    Find the trace file, tkprof it, and see exactly what happened and how much time it took.
    I'm assuming that timed_statistics is set to true in your instance.Edited by: user639946 on Dec 3, 2010 1:00 PM

  • How to improve response time of database

    We have 8.0.5 Oracle database with multiple users. that is running on NT. And several clients are accessing database trough application. The response time is really slow. How can I make access faster and where can I make my changes to take effect.
    Thank you.

    I tried several times to open/print The white paper on following address but always got an error something like 'There is an error on this document (14)':
    http://otn.oracle.com/products/reports/pdf/275641.pdf
    Can U please help to resolve this problem so that I can open this doc in Acrobat PDF viewer. I need this paper urgently as explained at the start of this question.
    Tariq

  • How can increase response time:dialog

    Dear all,
    how can i change(increase/decrease) dialog workprocess response time?

    > how can i change(increase/decrease) dialog workprocess response time?
    Can you please tell us exactly what you want to do?
    Read
    http://help.sap.com/saphelp_nw04/helpdata/en/21/2c8f38c7215428e10000009b38f8cf/frameset.htm
    about what "Response time" is defined and then please rephrase your question.
    Markus

  • How to calculate Average time from a date field

    Hi All,
    I have a date type field in my table .
    I want to calculate average time for a given country in a select query. Date has to be exculded. Only time has to be taken into consideration.
    Kindly help me.
    Sample data
    india 25-JUN-09 08:12:45
    india 25-JUN-09 09:01:12

    Take which one you want.WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT TO_CHAR(to_date(AVG(to_number(TO_CHAR(to_date(TO_CHAR(x,'HH24:MI:SS'),'HH24:MI:SS'),'sssss'))),'sssss'),'hh24:mi:ss')
       FROM dates;
    WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT floor(24 * AVG(x- TRUNC(x)))
      || ':'
      || floor(mod(24 * AVG(x- TRUNC(x)),1) * 60)
      || ':'
      || floor(mod(mod(24 * AVG(x- TRUNC(x)),1) * 60,1) * 60)
       FROM dates;By
    Vamsi

  • Unable to calculate response time.

    Hi,
    The response time for quality system is not getting updated. On further analysis we came to know the job SAP_COLLECTOR_FOR_PERFMONITOR ws not scheduled. we rescheduled the job. now it is running fine but still complete stats are not getting updated.( getting updated partly) missing few hours in between.
    Can you please help.
    Thanks,
    Vijay

    Hi Markus,
    This jobs are already scheduled. I have already checked SAP_COLLECTOR_FOR_PERFMONITOR. This is running on a hourly basis. SAP_COLLECTOR_FOR_JOBSTATISTIC is running on daily basis. now is there something else we need to check.
    Thanks in advance
           Vijay

  • How to calculate total time of mouse movement

    Hi Everyone.
    I am doing project on gesture recognition with touchpad. I need to find out the total time of completion of gesture on touchpad. For that I need to calculate total time of cursor movement on laptop touchpad. When cursor starts moving, that time I need to capture time and when it stops also. I need to find out difference between the start time and stop time. Please help me to do this task. Presently I am trying with event structure and timed structure but I am getting only present time only. I tried with counter but unable to get the difference.

    I missed the mouse move event when I saw this earlier, and for some reason I thought the first attempt would give you what you wanted. 
    Here is a different VI. It uses mouse move event with some logic that remembers the first mouse move event. Otherwise, you won't get the correct time.
    Attachments:
    Mouse Move Time.vi ‏11 KB

  • How to make response time of switch faster?

    on 3750, when
    1. execute ping -t command from a PC to the switch interface vlan 1 ip address,
    2. unplug the cable and plug it again,
    it takes about 30 seconds to start pinging again.
    i disabled the STP protocol and observed that; with the same procedure, recovering ping replies decreased to 3 seconds.
    is there any other tuning that i can configure and make response time even faster?
    thank you for helping :)

    Hi,
    STP convergence is typically the biggest part of host connection delays. Rather than disabling STP, you can configure "spanning-tree portfast" on the port which will achieve the same end.
    Beyond that, some of the response time delays are going to be part of MAC address learning, ARP, and the fact that the switch places a low priority on processing ICMP packets. A better test is to ping from another device _through_ the switch rather than to or from the switch.
    Here's a good document that covers various commands you can use to mitigate connectivity delays.
    Using PortFast and Other Commands to Fix Workstation Startup Connectivity Delays
    http://www.cisco.com/warp/customer/473/12.html
    HTH,
    Bobby

  • How to Calculate the Time Between two days in ABAP

    Hi,
                  I have one scenario like i need to calculate the time between two days please can you suggest me.
    Thanks,
    Harinath

    Hi Peeleti,
                Check this code,
    DATA : DATE1 LIKE SY-DATUM VALUE '19830125',
           DATE2 LIKE SY-DATUM VALUE '20070219',
           DAYS1 TYPE I,
           WEEK1 TYPE I,
           MONTH1 TYPE I,
           YEAR1 TYPE I,
           C_YEARS1 TYPE I.
    CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
    EXPORTING
      BEGDA           = DATE1
       endda           = DATE2
      TAB_MODE        = ' '
    IMPORTING
      DAYS            = DAYS1
      C_WEEKS         =
      C_MONTHS        = C_YEARS1
      C_YEARS         = C_YEARS1
      WEEKS           = WEEK1
      MONTHS          = MONTH1
      YEARS           = YEAR1.
      D_MONTHS        =
      MONTH_TAB       =
    *WRITE : / 'DAYS   = ', DAYS1,
            / 'WEEKS = ',WEEK1,
          /  'MONTHS = ', MONTH1,
          / 'YEARS   = ', YEAR1.
    Using this code you can calculate the No Of Days Between two dates. Based On days you will easily calculate the Hour. [  No of days * 24 ].
    Thanks.
    Reward If helpful.

  • How to calculate the time difference in answers

    Hi,
    I need to calculate the time difference in BI answers and I dont have the access to the repository. I have the data in the following format
    10/12/2005 7:24:19 PM 10/12/2005 7:32:04 PM
    10/12/2005 7:50:47 PM 10/12/2005 8:52:36 PM
    10/12/2005 7:54:23 PM 11/4/2005 10:47:32 PM
    10/12/2005 9:05:51 PM 10/12/2005 9:08:58 PM
    10/12/2005 9:07:42 PM 10/12/2005 9:14:47 PM
    10/12/2005 9:09:02 PM 10/12/2005 9:10:57 PM
    I need to get the elapased hours between these two columns. Please help me
    Thanks

    you can use beans or create a case when statement like:
    case
    when TimeStampDiff(SQL_TSI_Min, table.column1, table.column2 ) <= 60 then 1 else
    when TimeStampDiff(SQL_TSI_Min, table.column1, table.column2 ) > 60 and TimeStampDiff(SQL_TSI_Min, table.column1, table.column2 ) <= 90 then 1.5 else
    when TimeStampDiff(SQL_TSI_Min, table.column1, table.column2 ) > 90 and TimeStampDiff(SQL_TSI_Min, table.column1, table.column2 ) <= 150 then 2.5 else
    end

Maybe you are looking for

  • Not able to get the profile option value

    Hi, Not able to get the profile option value after i changed the new value in the application. I am using fnd_global.apps_initialize to initialize the apps from PLSQL code to get the updated profile option value. But fnd_profile.value is not getting

  • Problem with iDVD - cannot burn DVD.

    Problem with iDVD - cannot burn DVD. Self has a MacBook Pro, which al new software. My problem is, when my burn a slideshow, prop process ever before burning. Box show: Multiflexing and burning: write Lead-in, then the process stops and ejects the di

  • Stock & Non-stock material

    Hi experts,   How to find which material is stock and nonstock from the internal goods/services list in SRM frontend Thanks in advance Kala

  • I2C timing Problem

    I am implementing an I2C protocol on labview fpga. I am using cRio 9074 and digital I/O module 9401 for this purpose. Since SDA line is a bidirectional line, I am using a method node to set line directions and the node is taking around 100 us to get

  • Get keyEvents!!

    I would like to take the event of the keys "Alt + F4" = "close". Thanks .