calculation of time between two time as timestamp

How can calculate two hour, START as the timestamp TIME in the data type, END TIME as of time also.

select END_TIME-START_TIME from PROG_DLY_WORK

Result

+ 01:50:00.000000 000000000

How can get exactly the time spent as 01:50 ? and these calculated time must sum (elapsed_time) in another column.

oracle as PaaS cloud environment

Product VERSION STATUS
NLSRTL11.2.0.3.0Production
Oracle Database 11g Enterprise Edition11.2.0.3.064 bit Production
PL/SQL11.2.0.3.0Production
AMT for Linux:11.2.0.3.0Production

Time difference between two columns in hours

Start

FOR REC IN (SELECT START_TIME, END_TIME, CALC_TIME CAL_ID)

LOOP

UPDATE CALc_TIME

SET ELAPSED_TIME = round (())

TO_DATE (to_char (REC. End_time, 'ddmmyyyyhh24miss'),

"ddmmyyyyhh24miss")-

TO_DATE (to_char (REC. Start_time, 'ddmmyyyyhh24miss'),

"ddmmyyyyhh24miss")

() * 24).

WHERE CAL_ID = REC. CAL_ID;

END LOOP;

end;

Lag in minutes

Start

FOR REC IN (SELECT START_TIME, END_TIME, CALC_TIME CAL_ID)

LOOP

UPDATE CALc_TIME

SET ELAPSED_TIME = round (())

TO_DATE (to_char (REC. End_time, 'ddmmyyyyhh24miss'),

"ddmmyyyyhh24miss")-

TO_DATE (to_char (REC. Start_time, 'ddmmyyyyhh24miss'),

"ddmmyyyyhh24miss")

() * 24 * 60)

WHERE CAL_ID = REC. CAL_ID;

END LOOP;

end;

Tags: Database

Similar Questions

  • calculation of duration between two events

    Hello guys

    I found a lot of information here how to calculate the difference in time between two events. The application I'm working with has a strange time resembling the export:

    The date looks like jj-mm-aa which I want to turn the date in dd-mm-yy format for easy sorting and I want to have the time difference in hours and minutes between two events. I thought the first thing to do is to extract the time information, then transform the date into the aa-mm-jj and calculate the time difference from these two. Can someone help me with this?

    Thank you very much

    Hans

    Hello

    You can try something like that.

    Table 1
    
    A1  date time string
    A2  20-03-16 00:52:22
    A3  19-03-16 01:26:17
    A4  18-03-16 01:41:30
    A5  16-03-16 00:01:08
    A6  11-03-16 23:40:42
       
    B1  date time
    B2  =DATE("20"&MID(A2,7,2),MID(A2,4,2),MID(A2,1,2))+TIMEVALUE(TIME(MID(A2,10,2),MID(A2,13,2),MID(A2,16,2)))
    B3  =DATE("20"&MID(A3,7,2),MID(A3,4,2),MID(A3,1,2))+TIMEVALUE(TIME(MID(A3,10,2),MID(A3,13,2),MID(A3,16,2)))
    B4  =DATE("20"&MID(A4,7,2),MID(A4,4,2),MID(A4,1,2))+TIMEVALUE(TIME(MID(A4,10,2),MID(A4,13,2),MID(A4,16,2)))
    B5  =DATE("20"&MID(A5,7,2),MID(A5,4,2),MID(A5,1,2))+TIMEVALUE(TIME(MID(A5,10,2),MID(A5,13,2),MID(A5,16,2)))
    B6  =DATE("20"&MID(A6,7,2),MID(A6,4,2),MID(A6,1,2))+TIMEVALUE(TIME(MID(A6,10,2),MID(A6,13,2),MID(A6,16,2)))
       
    C1  duration
    C2  =B2-B3
    C3  =B3-B4
    C4  =B4-B5
    C5  =B5-B6
    C6  =B6-B7
    

    Notes.

    Formula in B2 and C2 can be filled down.

    Table is designed with numbers v2.

    Kind regards

    H

  • Calculating the distance between two images... ?

    Hello

    I'm trying to calculate the distance between two images (A and F - there are other images between A and F), but I can't seem to understand how to make good sense.

    Image A.x is "(stage/2)-(A.width/2)" and the image of F.x is "provable - imgSpace" which is a negative value (all images x is a negative value for image A.x). "

    In my view, the calculation is F.x - A.x, and although it could be good I still ned the value to be non-negative.

    Does anyone know how to do this?

    Thanks in advanse...

    I think you can find out the distance with this equation,

    var len:Numer = Math.abs (A.x - F.x);

  • To calculate the elapsed time between two attributes of timestamp

    Hello
    I have two timestamp (create_tmstmp & elapsed_tmstmp) attributes in a table.
    It has two rows and I need the difference in seconds between these two attributes.
    The following query returns the negative value and an incorrect value.
    Any help is appreciated.

    1st row:

    Create_tmstmp: 2010-02-02 9:53:15.832 PM
    Elapsed_tmstmp: 03/02/2010 9:49:47.527 AM

    Line 2:

    Create_tmstmp: 03/02/2010 5:35:47.614 AM
    Elapsed_tmstmp: 03/02/2010 11:03:15.937 AM

    Select
    ((extract(day from elapsed_tmstmp)-extract(day from create_tmstmp)) * 86400 +)
    (extract(hour from elapsed_tmstmp)-extract(hour from create_tmstmp)) * 3600 +.
    (extract(minute from elapsed_tmstmp)-extract(minute from create_tmstmp)) * 60 +.
    ((extract(second from elapsed_tmstmp)-extract(second from create_tmstmp)) * 1000) completed_tmstmp
    From table_a;


    The result is:
    completed tmstmp_
    74655
    -11997

    Thank you.

    Published by: solsam on February 4, 2010 11:57
    with t as (
               select to_timestamp('2/2/2010 9:53:15.832 PM','mm/dd/yyyy hh:mi:ss.ff pm') Create_tmstmp,
                      to_timestamp('2/3/2010 9:49:47.527 AM','mm/dd/yyyy hh:mi:ss.ff pm') End_tmstmp
                 from dual
              )
    select (cast(End_tmstmp as date) - cast(Create_tmstmp as date)) * 86400  + to_char(End_tmstmp,'.ff') - to_char(Create_tmstmp,'.ff') elapsed_seconds
      from t
    /
    
    ELAPSED_SECONDS
    ---------------
          42991.695
    

    SY.

  • Calculation of connection between two fields

    In my PDF, I have two fields - allows you to call the A and B.

    When you enter the number 26 in the to field, B field should automatically generate the value 14 (less than the value in A 12). I managed to get this working.

    However, I wish this works in reverse, so that if you field a number (for example, 3) in the B field, will automatically generate the number 15 (greater than the value of B 12).

    Unfortunately, I can't get either to work, but not both. If I set the to field with the formula, all what I enter in the B field cannot substitute the calculation generated from the value defined in A.

    Any ideas on how I can get this working? Thank you.

    You can use JavaScript in the Calculate of the two fields event.

    For example, in the first field, do something like:

    (function () {
    
        if (event.source && event.source !== event.target) {
            event.value = +getField("text2").value + 12;
        }
    
    })();
    

    and in the other field, use:

    (function () {
    
        if (event.source && event.source !== event.target) {
            event.value = +getField("text1").value - 12;
        }
    
    })();
    

    Change "text2" and "text1" to match the domain names that you use.

  • difference in hours between two time zones of differnet

    I have a sysdate (EAST) and a function util_pkg.local_tz returns a different datetime value.
    I need to get the difference in hours between sysdate and another date.

    Select sysdate, util_pkg.local_tz (sysdate, ' Asia/Seoul') of double;

    18/05/2011 11:15:00.000000000 FROM 18/05/2011 10:15 PM + 09:00

    Quest:-find the difference in hours between these two date and then add the difference of hours + sysdate

    FUNCTION local_tz (p_datetime IN TIMESTAMP,
                          p_timezone IN VARCHAR2)
          RETURN TIMESTAMP WITH TIME ZONE
       AS
       BEGIN
          RETURN FROM_TZ(p_datetime, TZ_OFFSET(con_database_timezone))
                         AT TIME ZONE TZ_OFFSET(p_timezone);
       END local_tz;

    When you calculate the diff between TIMESTAMP WITH TZ they both are converted to time UTC (in fact they are stored as UTC). So diff between SYSTIMESTAMP in EST and SYSTIMESTAMP in Seoul will always be 0, as bioth are "now". You need to cast TIMESTAMP WITH TZ 'losing' time zone timestamp:

    SQL> select cast(systimestamp at time zone 'Asia/Seoul' as timestamp) - systimestamp from dual;
    
    CAST(SYSTIMESTAMPATTIMEZONE'ASIA/SEOUL'ASTIMESTAMP)-SYSTIMESTAMP
    ---------------------------------------------------------------------------
    +000000000 13:00:00.000000
    
    SQL>  
    

    SY.

  • Take the time between two values

    Hi people,

    I have a problem and I know idea how to solve... I need help.

    The problem is I want to take the time between two values max as you can see in the chart.

    For example, in the image that I have add

    4.5 - 1 840 = 2.66

    And enter this value in the 'time between mostra '.

    It's that I want...

    But what I think is very complicated, because I don't know how to take the time correctly and does remove...

    Thank you very much

    Any solution?

    Hi jocuma,

    I tried something and hope that helps u.

    Just create two arrays of temperature and voltage. First of all, I'll get the value of the voltage when it is more of a certain value and that same index to get the value of time and store in the shift register.

    When I get the second higher than the limit value, I'll get time and subtract the previous value.

  • Measure the time between two digital pulse

    Hello

    For a non-critical calendar application, I need to measure the time interval between consecutive TTL pulses, ranging from the order of 0.5 s for a few seconds, with a low accuracy of +/-10-50ms. The interval being measured varies between the rising edge of the first pulse and the front of the next and so on.

    I have several input lines I need to deal with. Because it's a critical machination low cost, I don't want to use digital counters for each line, so I work with an acquisition of data USB6008 and have connected the input rows TTL on the digital inputs of the device. Avoiding will be sufficient.

    I found a good example of VI on discussion forums that does almost the same thing, only it uses instead of the DAQ Assistant user input. The VI works including the time the program going on in a while loop. I replaced with the DAQ Assistant output (a channel) user input in the hope that it is still work.

    When I run the program in "run once" mode, it seems to work perfectly. However, in "continuous run" it measures only a very small interval, probably just the time between two samples.  I think it has something to do with the help of a while loop in combination with the DAQ Assistant. Anyone who has any suggestions how to solve this problem?

    Thank you!

    OK... first of all, you should never use the button "run continuously.  I wish that NEITHER would be to eliminate it, but told me that it is sometimes useful for debugging.  If you want your program to run over and over again, use a while loop with a stop"" button.

    If I'm reading your code correctly, you make your initial moment, and then collect data from data acquisition.  When one of the channels is "T", you stop your loop and the end time of capture.  (By the way, why you convert your table to a cluster?  Why not just index the appropriate channel in the table directly?)

    Since you want to capture the time between two consecutive pulses, you need to know when a transition has occurred... i. e when your digital line went from F (no pulse) to T (pulse start).  This will give you your forehead.  Right now, all you're doing is looking for a value T - so you have no way of knowing if you are looking for to the previous impulse again, or a new impetus.  You also burn 100% of your processor with the way you have your programme in place.

    You need a small loop delay so that your VI is not 100% of your hogs CPU time.  Given that you can live with an accuracy of 50msec, what I suggest that you use.

    See attached picture for you give an idea of how to implement.  He will probably need some refining operations, but it should point you in the right direction.

    I hope this helps.

  • time measurement between two finite pulse

    Hello Gerd

    Hello to you!

    I need support in the time between two pulses finished measure.

    Please find instant for the wave form, I want to measure the time between yellow and Red","yellow and blue ".

    Can you give me some indication to implement this thing?

    Concerning

    Nitin

    Oops Basics deliver,

    I'll implement the same and let you know if I find any difficulty.

    Thank you man.

  • Estimate the time between two computers

    Hello, everyone.

    I want to develop a program for communication between two ip addresses:

    IP1: 192.168.1.100

    IP2: 192.168.1.101

    Suppose IP1 is the server IP2 is the Viewer, then I want to put in place a program to estimate the elapsed time for IP1 contact IP2, but I don't know how to do.

    Also, I want to display the elapsed time for the connection (which varies due to fluctuations in the internet), performing actions such as continuously 'ping' the receiver from the server. Can someone show me the way to achieve this? Thank you very much.

    Best regards

    yukfai88

    Please do not shout

    How about using ping?

    Insert the output in an analysis of string to read the value you need. Sorry my OS is in German so you have to adapt ;-)

  • How do the time difference between two dates?

    Hi all

    I use this query to get the time difference between two dates.

    Select to_timestamp ('2012-10-03 12:00 ',' YYYY-MM-DD hh)-to_timestamp ('2012-10-03 11:00 ',' YYYY-MM-DD hh) as double diff;

    but do not get the correct result.

    Thank you

    Left KEY... Left Padding of tanks.

  • Difference between two times

    I am building a working method in LiveCycle, and I want to track how long the procedure takes. To do this, I have two time fields, and then a third time field to find the difference between two time fields. Looking at other posts to discussion, I could find a Javascript code that was part of what I wanted, but I can't get the third time field to display in the format I want. I tried to change the habits of the fields and that did not work. Could someone offer some advice on how to change the format or help me with the code?  I couldn't figure to attach the actual file, but I have attached a picture of the PDF file and the Javascript code I used.  If you look at the TimeIn (hh: mm) and time (hh: mm) areas (on the photo, I have attached), you will notice that the TotalTime comes out like HMM, and I want that it out as hh: mm.

    Adobe Time Difference Example.jpg

    Javascript Time Difference Code.jpg

    Any help would be greatly appreciated!

    Thank you

    this.rawValue = (totalHrs > 9? String (totalHrs): '0' + String (totalHrs)) + ':' + (totalMins > 9? String (totalMins): '0' + String (totalMins));

  • Dynamic action - Get the difference between two dates + times

    I have problems a little dynamic to work action. I'm trying to get the time between two dates with the time difference.

    Here is what I got (this is apex 4.0):

    Two date pickers + two numbers fields (date/start/end times)

    I created a dynamic action on the page who fires on the point lose focus (above points).

    The real action for the DA is the body of the PL/SQL function:
    declare
      end_date DATE;
      start_date DATE;
    Begin
      start_date := to_char(:P1_START_DATE || ' ' || :P1_START_TIME, 'DD-MON-YYYY HH:MIAM');
      end_date := to_char(:P1_END_DATE || ' ' || :P1_END_TIME, 'DD-MON-YYYY HH:MIAM');
      :P1_HOURS := end_date-start_date;
    End;
    When I change the values on the page, I get the following error:

    AJAX call back Server error ORA-06502: PL/SQL: digital or value error: character number conversion error to set the value.

    I'm guessing that there is a problem with the date formatting, but I can't make it work. Thanks in advance!

    Hi djston,

    because you chose the dynamic action of 'Set value' with the "Body of the PL/SQL function" type you need to return the value. Try the following code

    declare
      end_date DATE;
      start_date DATE;
    Begin
      start_date := to_date(:P1_START_DATE || ' ' || :P1_START_TIME, 'DD-MM-YYYY HH:MIAM');
      end_date := to_date(:P1_END_DATE || ' ' || :P1_END_TIME, 'DD-MM-YYYY HH:MIAM');
      RETURN (end_date-start_date)*24;
    End;
    

    and P1_REQUESTED_HOURS like 'item affected. "

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

    Published by: Patrick Wolf on January 17, 2011 10:54

  • Find the difference between two date and time

    Hi friends,

    I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."

    select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed  
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate) 
    order by sql_step_num;

    You try to get the feel between two char strings.
    And more difference between two dates gives a NUMBER of days.
    Try this:

    select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate)
    order by sql_step_num;
    
  • Find the time to intersampling between two channels AI USB 6251

    Hello

    I want to know how late it is between two-channel sampling of HAVE in a USB-6251 (term mass) used in conjunction with a block of connection SCB - 68 (Labview 8.5, Windows XP).  I realize that there's only an ADC and simultaneous acquisition is not available.  The specs are listed as follows:

    Sampling frequency:

    Maximum: 1.25 MECH. / s single channel;  1,00 multi-channel MECH. / s (aggregate)

    Minimum configuration: no minimum

    Timing accuracy: 50 ppm of sampling frequency

    Temporal resolution: 50 ns

    We know of a way to understand this point other than by experimentation?

    See this

Maybe you are looking for