Function to calculate time elapsed needed

Hi all,
I need a function which will give me total time elapse if I provide 2 dates with timings.
ie Date1 : "23-Feb-2005 21:00:00"
Date2 : "21-Feb-2005 22:00:00"
output should be somewhat like
1 day ,23 hrs ,00 mins and 00 secs( i.e total time elapsed).
Regards

Hi,
You have the solution in Metalink note
1035465.6: How to Display Date Difference Values in Years, Months, Days
Nicolas

Similar Messages

  • How to use case when function to calculate time ?

    Dear All,
    May i know how to use case when function to calculate the time ?
    for the example , if the First_EP_scan_time is 12.30,  then must minus 30 min.  
    CASE WHEN FIRSTSCAN.EP_SHIFT <> 'R1' AND FIRSTSCAN.EP_SHIFT <> 'R2'
    THEN ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF((CASE WHEN SHIFTCAL.EP_SHIFT = 'N1'
    THEN CONVERT(VARCHAR(8),DATEADD(DAY,+1,LEFT(FIRSTSCAN.EP_SCAN_DATE ,8)),112) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','')
    ELSE LEFT(FIRSTSCAN.EP_SCAN_DATE ,8) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','') END),12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0 - 0.25) AS FLOAT),2)
    ELSE ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF(FIRSTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0) AS FLOAT),2) END AS OTWORK_HOUR

    Do not use computations in a declarative language.  This is SQL and not COBOL.
    Use a table of time slots set to one more decimal second of precision than your data. You can now use temporal math to add it to a DATE to TIME(1) get a full DATETIME2(0). Here is the basic skeleton. 
    CREATE TABLE Timeslots
    (slot_start_time TIME(1) NOT NULL PRIMARY KEY,
     slot_end_time TIME(1) NOT NULL,
     CHECK (start_time < end_time));
    INSERT INTO Timeslots  --15 min intervals 
    VALUES ('00:00:00.0', '00:14:59.9'),
    ('00:15:00.0', '00:29:59.9'),
    ('00:30:00.0', '00:44:59.9'),
    ('00:45:00.0', '01:00:59.9'), 
    ('23:45:00.0', '23:59:59.9'); 
    Here is the basic query for rounding down to a time slot. 
    SELECT CAST (@in_timestamp AS DATE), T.start_time
      FROM Timeslots AS T
     WHERE CAST (@in_timestamp AS TIME)
           BETWEEN T.slot_start_time 
               AND T.slot_end_time;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Need a function to calculate employee attendance data for a given period

    need a function to calculate employee attendance data for a given period
    as
    Working days,
    CL ,
    SL,
    PL,
    LWP
    regards,
    Gaurav Sood.

    Issue resolved

  • Why need to give Function group at time of  table maintence generation

    Dear All,
    why need to give Function group at time of  table maintence generation
    Regards,
    Laxman  Sankhla

    Hi Laxman,
    The F1 help of the field says:
    Name of the function group, to which the generated maintenance modules will belong.
    Means the PBO & PAI modules of the screen will be created under this Functio group.
    Regards
    DKS

  • I need PDF fields to calculate time worked and convert to hours and tenths by set formula

    I have been working on a PDF form which has a "time in" field, "time out" field, "total time" and "accumulated time" fields. I have found a couple of forms online which I tried copying the code and it will not work. There is a formula here that they go by, i.e. 0-3 minutes = 0, 4-9 minutes + .1.
    I found code for the conversion but am a beginner at writing code and I am getting errors in the scripting box which I don't understand.
    Does anyone have code written that would work for the Total Time field that will calculate the time between the in and out fields and convert to a set formula? I can get the accumulated field to work.
    I used this:
    document.write(Math.round(0.60) + "1.0");
    document.write(Math.floor(0.57) + "0.90");
    document.write(Math.floor(0.51) + "0.80");
    document.write(Math.floor(0.45) + "0.70");
    document.write(Math.floor(0.39) + "0.60");
    document.write(Math.floor(0.33) + "0.50");
    document.write(Math.floor(0.27) + "0.40");
    document.write(Math.floor(0.21) + "0.30");
    document.write(Math.floor(0.15) + "0.20");
    document.write(Math.floor(0.09) + "0.10");
    document.write(Math.floor(0.03) + "0.00");
    but am missing code to make it work. I am on Acrobat Pro Extended on a Windows 7 platform.
    Thank you in advance, Annette

    I've developed a script that can automatically add these calculation to
    multiple fields, including the total field.
    Have a look here:
    http://try67.blogspot.com/2011/03/acrobat-calculate-time-differences-in.html
    PS -  document.write() is not a valid method in a PDF.

  • Query to calculate time frames

    hello,
    id like to write a query that will calculate time frames ;
    my source table looks like this:
    company     category     date
    ORACLE     A     1/01/2012
    ORACLE     A     2/01/2012
    ORACLE     B     3/01/2012
    ORACLE     C     4/01/2012
    IBM     A     1/01/2012
    IBM     A     2/01/2012
    IBM     A     3/01/2012
    IBM     A     4/01/2012my desired result:
    company     category     from     to
    ORACLE     A     1/01/2012     2/01/2012
    ORACLE     B     3/01/2012     3/01/2012
    ORACLE     C     4/01/2012     31/12/2999
    IBM     A     1/01/2012     31/12/2999can you please guide me with use of which functions i can achieve that?
    id appreciate any tips
    thank you
    rgds
    Edited by: UserMB on Jan 11, 2012 5:14 PM

    One way...
    ME_XE?with t as
      2  (
      3    select 'ORACLE' col1, 'A' col2, to_date('1/01/2012', 'dd/mm/yyyy') col3
      4      from dual
      5    union all
      6    select 'ORACLE', 'A', to_date('2/01/2012', 'dd/mm/yyyy')
      7      from dual
      8    union all
      9    select 'ORACLE', 'B', to_date('3/01/2012', 'dd/mm/yyyy')
    10      from dual
    11    union all
    12    select 'ORACLE', 'C', to_date('4/01/2012', 'dd/mm/yyyy')
    13      from dual
    14    union all
    15    select 'IBM', 'A', to_date('1/01/2012', 'dd/mm/yyyy')
    16      from dual
    17    union all
    18    select 'IBM', 'A', to_date('2/01/2012', 'dd/mm/yyyy')
    19      from dual
    20    union all
    21    select 'IBM', 'A', to_date('3/01/2012', 'dd/mm/yyyy')
    22      from dual
    23    union all
    24    select 'IBM', 'A', to_date('4/01/2012', 'dd/mm/yyyy') from dual
    25  )
    26  select
    27    col1, col2, min(col3), case when max(col3) = max_company_date then to_date('31/12/2999','dd/mm/yyyy') else max(col3) end
    28  from
    29  (
    30    select col1, col2, col3, max(col3) over (partition by col1) as max_company_date
    31    from t
    32  )
    33  group by col1, col2, max_company_date;
    COL1               COL MIN(COL3)                  CASEWHENMAX(COL3)=MAX_COMP
    ORACLE             B   03-JAN-2012 12 00:00       03-JAN-2012 12 00:00
    ORACLE             A   01-JAN-2012 12 00:00       02-JAN-2012 12 00:00
    ORACLE             C   04-JAN-2012 12 00:00       31-DEC-2999 12 00:00
    IBM                A   01-JAN-2012 12 00:00       31-DEC-2999 12 00:00
    4 rows selected.
    Elapsed: 00:00:00.01
    ME_XE?

  • Any function to calculate actual work hours (deduct the break hours)

    Hi expert,
    I have defined the daily work schedule & break schedule. Work center is assigned with the daily work schedule. Now I want to calculate each work center actual work hours. I have a table where the start & finish time of working is keep.
    for eg.
    first break hr 10:00am to 10:15am
    second break hr 13:00pm to 14:00pm
    The work center might start work from 10:05 and finished at 14:30 or any other case.
    I need to deduct the break hrs & get the actual hr worked
    Is there any function to calculate the actual work hours base on the daily work schedule & break schedule ?
    Thanks

    Hello,
    Try the below FM's
    HR_PERSONAL_WORK_SCHEDULE
    WORKING_HOURS = 'X'  " you will get the actual work hours
    HR_BE_WORKING_SCHEDULE
    Try the below class
    CL_PT_TIME_EV_WORK_SCHED_UTIL
    Regards,
    Krishna
    Message was edited by:
            Krishnakumar

  • Media encoder time remaining stops decreasing and processor drops to zero. Time elapsed keeps going up! File won't complete!

    Please help anyone who can.
    Firstly I know I have very little RAM on my system, only 4GB but I've been rendering the same kinds of files for weeks with no problems until the last few days.
    They biggest issues is as follows:
    My timeline in Premiere Pro CC 2014 has 1080p 50mbps MXF footage from a Sony PMW 200 and some similar footage replaced with an After Effects comp for green screen keying.
    The clip, approx 2min, starts with a linked comp from after effects, then cuts to the mxf footage and back to a linked comp at the end.
    I am exporting via media encoder to h264 1080p. The file rendered fine for about 40min with the processor at 50% approx. The processor then shot up to 99% for 10 mins and the render progress bar
    went up to almost 90% complete.
    Then the progress bar stopped, the processor dropped to 0%, time remaining is steadily climbing and so is time elapsed. I've tried pausing and un pausing the render que and nothing else is running in background.
    I need these files rendered tonight!! I've tried this a few times and this problem keeps occurring sometimes with the remaining time shooting up to 74 hours!!
    Can anybody tell me what I'm doing wrong?!
    Windows 7 Professional (64 bit)
    Dell Precision workstation 690
    Intel xeon X5365 3ghz (x2)
    4 GB RAM

    Sounds exactly like what is happening to me.  This is frustrating because it was a 30 hour encoding process and the place where it is stuck is right at the very end of the sequence on the 2nd pass, although there is still about 12% of the progress bar remaining.  I guess that this is where it takes all its work and puts the separate files into the single video file. I really don't want to go through this again. The final video file is showing up though and is shown having the size that I am expecting it to be.
    Any workarounds to somehow get this unstuck?  I am hesitant to just try and open the file. I am going to try a couple of things and if I am successful at getting this to finish without restarting then I will be sure to post it here.
    Also, I don't know if this has anything to do with this problem, but I looked at my system Activity Monitor, and there is a CPU process highlighted in red, it states:
         Adobe QT32 Server (not responding)
    Thirty minutes later...
    I was incorrect above as to the actual problem.  I paused the queue encoding that was stuck, then opened up the project again in Premiere Pro only to discover that there was an offline still image which I stupidly had renamed during the day. So I renamed the file back to its original name, reconnected the picture, saved the PP project. Then I started the encoding back up and still no luck.
    So I paused the encoding again, went back into the PP project and rendered just the area under question, saved it, and exported it into the queue. Then just to be safe I went to the paused item in AME, and duplicated it adding another version into the queue.
    Then I unpaused the encoding and ... SUCCESS!!  Not sure which of the final steps did the trick, but I am guessing that it was the rendering of the part of the sequence that it was stuck on.  Hope this helps someone.

  • Function to calculate Page size in XML RTF template

    Hi All,
    For one of my requirments, I need to find out the page size of my output.
    And from a given point of the output, i should know the size till bottom of the page.
    My program has an RTF and will generate output in PDF format.
    Please let me know how to do this. This is very important for me.
    Thanks in advance.
    Edited by: DharV on Nov 17, 2011 12:18 AM

    No, the actual requirment is in this thread
    Re: Need to drag the table down the end of page
    I could not get the solution for this, so just checking if I have a function to calculate the horizantal size of the output page, and i can apply some logic.
    Let me know if iam not clear
    Thanks
    Edited by: DharV on Dec 6, 2011 1:14 AM

  • How to implement the Transfer Function in Real Time VIs?

    Hi all,
    I'm relatively new to Labview Real Time modoule and want to implement one Controller(not PID one) in Deterministic Loop! I have already designed discrete Transfer Function and searching for the way to build one Controller with it! Is it right to use the Simulation Loop instead of Timed Loop (in this case Deterministic loop) and implement the controller in it?! If it's correct so, should I use the same clock and Priod as Timed Loop?!
    It would be very helpful, if there is an Example about using transfer function in Real Time Loops!
    thanks for your help,
    Mohsen 

    Hello mhmdi,
    Sorry I can't open your VI (looks like it is a new version of LV than I have installed).
    You're right - you don't need to convert to a difference equation if you have the CD&SIM Module which can take discrete time transfer functions directly. You don't need shift registers with this function, as it is effectively done internally. If you don't have CD&SIM discrete TF's can be implemented easily just in a timed (or while) loop with feedback nodes or shift registers to replicate each z-1 you need.
    Some more ideas:
    There are many configuration parameters and options with the Discrete TF VI - which you need to understand for your application and make sure are correct. Sometimes implementing in a basic form (timed loop and shift registers) allows you to see what is happening without any confusing options you might not need.
    Are you using the Discrete TF VI in a Simulation Loop ? You might need to think if the loop being used is appropriate for a Real Time application. Maybe the timing of the TF, the loop and the DAQmx data are not all suitable for each other.
     I'm not familar with DAQmx, so not sure about any specific real-time aspetcs of that.
    "if the sample frequency of the discrete transfer function in the timed-loop is at multiple integers of the sampling rate (e.g. 12000 Hz for tranfer function and 4000 Hz for sampling rate, 12000=3*4000), would it somehow improve the resolution of the controller command?"
    This could actually make things worse - but depends on your transfer function if it is a problem. Think about it this way - in the scenario you state the input signal going into the Discrete TF will only change once in every three samples, that means if your transfer function includes a 1-z^(-1) factor (i.e. a derivative) - that will be zero for two samples then jump up for the next sample. You'll observe a very jittery/noisy signal, but the noise is due to samples not being correct. This will also occur if the sample times are very similar but go in and out of sync where you may get the occassional sample that is the same and hence the occassional zero in the TF.
    In an application I had we had problems trying to get the data coming into a timed loop and the timed loop itself synchronise, and before it was fixed the control signal was very jittery.
    Consultant Control Engineer
    www-isc-ltd.com

  • *ERROR* Hangcheck timer elapsed

    Hi,
    I'm using intel sandybridge graphics (xf86-video-intel 2.15.0) with linux 2.6.38.4. Whenever I run app that requires OpenGL(e.g. glxgears), I GPU hangs about every 3 seconds.
    dmesg shows:
    [   58.693676] [drm:i915_hangcheck_ring_idle] *ERROR* Hangcheck timer elapsed... blt ring idle [waiting on 6200, at 6200], missed IRQ?
    I googled and didn't find anything useful. I thought is was a bug and should be fixed in the future until today when I tried Ubuntu 11.04.
    When I boot to Ubuntu 11.04, glxgears ran perfectly, no GPU hangs no strange white striped or flicker (https://bugs.archlinux.org/task/23771)
    I noticed that ubuntu is using kernel 2.6.38 and xf86-video-intel 2.14.0.
    Anyone knows how come this can happen? or how to fix this?
    Thanks

    Falcata wrote:
    I was about to post a new topic about this, but it seems I don't need to.  I encountered this problem last night when I was converting my old server to a media system.  This is what lspci says about my server's GPU:
    00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01)
    Going to install kernel26-lts and see if that helps any
    You can try this setup: https://bbs.archlinux.org/viewtopic.php … 58#p937758

  • Execution time, elapsed time  of an sql query

    Can you please tell me how to get the execution time, elapsed time of an sql query

    user8680248 wrote:
    I am running query in the database
    I would like to know how long the query take the time to completeWhy? That answer can be totally meaningless as the VERY SAME query on the VERY SAME data on the VERY SAME database in the VERY SAME Oracle session can and will show DIFFERENT execution times.
    So why do you want to know a specific query's execution time? What do you expect that to tell you?
    If you mean that you want to know how long an existing query being executed is still going to take - that's usually quite difficult to determine. Oracle does provide a view on so-called long operations. However, only certain factors of a query's execution will trigger that this query is a long operation - and only for those specific queries will there be long operation stats that provide an estimated completion time.
    If your slow and long running query does not show in long operation, then Oracle does not consider it a long operation - it fails to meet the specific criteria and factors required as a long operation. This is not a bug or an error. Simply that your query does not meet the basic requirements to be viewed as a long operation.
    Oracle however provides the developer with the means to create long operations (using PL/SQL). You need to know and do the following:
    a) need to know how many units of work to do (e.g. how many fetches/loop iterations/rows your code will process)
    b) need to know how many units of work thus far done
    c) use the DBMS_APPLICATION_INFO package to create a long operation and continually update the operation with the number of work units thus far done
    It is pretty easy to implement this in PL/SQL processing code (assuming requirements a and b can be met) - and provide long operation stats and estimated completion time for the DBA/operators/users of the database, waiting on your process to complete.

  • Query Execution time - Elapsed time v Actual time taken

    Hi All,
    I have this scenario where I am querying a single table with the following results. It is a very heavy query in that there are multiple aggregate functions and multiple unions on it. Even if the query is written poorly (i doubt it is) why would the actual
    time taken to execute the query be much more than the statistics provided through the following commands?
    SET STATISTICS IO ON;
    SET STATISTICS TIME ON;
    Attached are the stats provided for the relevant query in question.
    Table '123456789_TEMP_DATA'. Scan count 178, logical reads 582048, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    SQL Server Execution Times:
       CPU time = 936 ms,  elapsed time = 967 ms.
    2014-01-06 17:36:41.383
    Now, although the CPU Time/Elapsed time shows that it takes less than a second, it actually takes more than 15 seconds to fetch the results. (This is the actual time that you get on the bottom bar of the Query pane as well.)
    What is the reason? Why is it that there is such a big discrepancy between the numbers? How can I improve this situation?
    Thanks!

    Yes. I am returning a huge number of rows to the client. 
    The query is simply against a single table. 
    Select
     'First Record',AVG(COLUMN1),STDEV(COLUMN1
    ),COUNT(COLUMN1)
    FROM [TABLE1] WHERE (SOME CONDITION)
    UNION ALL
    Select  'Second Record',AVG(COLUMN2),STDEV(COLUMN2),COUNT(COLUMN2) FROM [TABLE1]
    WHERE (SOME OTHER CONDITION)
    Imagine there are 178 records fetched in this manner with 178 UNIONs. The WHERE clause will always change for each SELECT statement.
    Now, the question is not so much about the query itself, but why the execution time is actually 15 seconds whilst the SQL STATISTICS show it to be 936ms (<1 second)
    Thanks!

  • Getting time elapsed in AS3

    I have some asynchronous stuff going on in my Flash movie and
    would like to determine how much time elapses between two events --
    e.g., a button click and the response from a socket server.
    I'm wondering how to go about this in AS3?

    Thanks for your response!
    I took your advice on using getTimer() and it's working
    swell. However, I was kind of hoping for something that didn't
    require my Flash movie to be running the whole time. I have learned
    that you can create a new Date object and access its time property
    and that will return a value in milliseconds. You can later create
    a new Date object, access its time property, and compare the two:
    var start:Date = new Date();
    trace('start:' + start.time);
    //calculate PI to a million digits or whatever
    var end:Date = new Date();
    trace('time elapsed:' + (end.time - start.time));
    I haven't tested that, but I think it'll work.

  • I am unable to move clips or apply transitions. I was able to use all the functions the last time I used premiere. Perhaps I locked something  by accident.

    I am unable to move clips or apply trantitions. I was able to use all functions the last time I used Premiere Pro.

    Reset Corrupted Preferences = Press/HOLD Ctrl+Alt+Shift while starting program
    -and setting http://forums.adobe.com/thread/1058426?tstart=0
    Also, More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

Maybe you are looking for

  • Is it possible to create a custom display type in DIAdem, for example a speedomete​r type instrument​?

    As an example I have velocity data which shows a vehicle accelerating from rest to 60 km/h and then travelling at a constant speed. As opposed to displaying this data using a 2D axis system is it possible to create a new speedometer display type to d

  • How to clear open apps from Iphone after newest update

    How do you close open apps after this newest update.

  • External mail configuration from SBWP

    Hi I need the steps to configuration of sending mails to external users (xxx.gmail.com)  from SAP system using t-code SBWP. Anyone please give me some steps to configure this. Thanks & Regards, Pradeep

  • IPod stop to work by itself

    Hello, I have an iPod Touch second generation, 8 GB (but I have only used 3GB) since 16 months. I have enjoyed my iPod and the facilities it offer.  I have noticed that my iPod has not working as it usually does.  It is too slow, and when I use it to

  • Access TimesTen in Perl

    What libraries do I need to access TT database through Perl? I'm running Perl under Solaris X86, and use the the standard PERL package with the Solaris. I'm getting the following error when I try to access the the TT DB ld.so.1: perl: fatal: relocati