Find the period by subtracting the start time and end

Version: 11.2

I am not a SQL expert.

I'm trying to subtract the start and end time and find the difference between these two times.

In the example below, the difference between the value of start_time and end_time is approximately 52 minutes (18:15 to 19:07)

I tried a few tricks to find the difference below. But it did not work.

SQL > create table t (start_time date, date of end_time);

Table created.

SQL > desc t

Name                                                              Null?    Type

----------------------------------------------------------------- -------- ---------------------

START_TIME                                                                 DATE

END_TIME                                                                   DATE

SQL > insert into values t (to_date (24 June 2013 18:15:42 ',' DD/MONTH/YYYY HH24:MI:SS'), to_date (24 June 2013 19:07:54 ',' DD/MONTH/YYYY HH24:MI:SS'));))

1 line of creation.

SQL > commit;

Validation complete.

SQL >

SQL >

SQL > select * from t;

START_TIME, END_TIME

--------------------     --------------------

24 June 2013 18:15:42 24 June 2013 19:07:54

-Trying to find the difference of Start_Time and End_Time

SQL > select end_time-start_time in t;

END_TIME-START_TIME

-------------------

. > 03625 than signifie.03625?

-More than failure tent

SQL > select to_number(end_time-start_time)/60 t.

TO_NUMBER(END_TIME-START_TIME)/60

---------------------------------

.000604167

SQL > select to_number(end_time-start_time) * 24/60 t.

TO_NUMBER(END_TIME-START_TIME) * 24/60

------------------------------------

.0145

SQL > select to_number(end_time-start_time) * 60 * 60 t.

TO_NUMBER(END_TIME-START_TIME) * 60 * 60

------------------------------------

130,5

SQL > select to_number(end_time-start_time) * 60 * 60/24 t;

TO_NUMBER(END_TIME-START_TIME) * 60 * 60/24

---------------------------------------

5.4375

Hello

Search Date arithmetic in the manual of the SQL language.

When you subtract one DATE from another, the result is the number of days between them.  .03625 days is a little more de.033333333... days, which is 1/30 a day, or 48 minutes.

If you want the difference in hours, multiply by the number of hours per day, which is 24.

If you want the difference in minutes, multiply by the number of minutes per day, or 24 * 60.

If you want the difference expressed in days hours: minutes: seconds, then you are better off conversion (at least) one of the DATEs in TIMESTAMP; then, when you subtract them, you will get the difference as an INTERVAL DAY TO SECOND, which appears as

+ 05:06:37.000000 000000000

This means that 0 days, 5 hours, 6 minutes, 37 seconds.

Tags: Database

Similar Questions

  • Creating a rule entry time custom to read the start time and the stop as entry time

    Hello world

    I hope this is the right forum to post this question.
    We are putting in place the time and work package, and we need to write a few rules of the time for this entry.

    The first of them is to have a rule that validates the start time and the stop time has entered the entry-level feature Self Service scorecard.
    So, I created a formula to achieve this objective. This formula eventually calls a PL/SQL function that checks for card points, the Start and Stop time values stored in the database.

    However, this is not what I intend to achieve. What I have to do is to get the value of time as she walked and apply the Validation

    This expansion in a scenario:

    1. the employee connects via the Self Service and access the timesheet feature to make a time entry
    2. on August 20, he entered 13:00 as the start time and stop time 20:00
    3. click on the button

    When he clicks on the button Save, (assume 20:00 is an incorrect time), an error message should be displayed to the user informing him of this

    ----------------
    Now, I have to spend the early hour 13:00 and the 20:00 in the formula stop time so that I can post it.
    This is where I run on issues that I don't know how to get these start and stop within the formula time

    Grateful if someone could help with this.
    It's quite urgent given the lead times for completion on that.

    Thks in advance folks
    Ravi

    l_timecard_info: = hxc_self_service_time_deposit.get_building_blocks;
    l_building_block_attr_info: = hxc_self_service_time_deposit.get_block_attributes;

    However, I do not understand this:
    If there are no parameters that are passed to these calls, then how the correct score card to be recognizable? I'm assuming that there is something like a Timecard_Id or setting Timecard_Ovn that allows to identify the correct sheet when reading this info.

    Pls advise me on this point, because I'm just not understand this bit.

    You do not need to pass all parameters. The overall picture of pl/sql is filled for the session before the rule of time entry. If you want to restrict, the formula will be an id_ressource of entry which is an employee self-service Person_Id. and compare this value against id_ressource in l_timecard_info.resource_id

    If this isn't an inconvenience for you, I want to understand how these function calls to keep the start time and stop time, and to access these variables, I would need to loop as a table through?

    The l_time_card_info of pl/sql table is filled exactly the same as how is stored in HXC_TIME_BUILDING_BLOCKS when save is saved / submitted. It's just that the pl/sql is here filled.

  • Search based on the start date and end date

    Hello

    I added two fields "Start Date" and "End Date" on a search page.
    I did the VO extension also.
    Now, I have to implement the logic of the search to get all records created between' start' and 'End Date' after pressing the "GO" button on this page.

    Can someone please provide advice to extend the controller.

    Thanks in advance.


    Gaurav.

    I think that the path would be

    Import oracle.apps.per.common.webui.PerTransactionTopCOImpl;

    Thank you
    -Anil
    http://oracleanil.blogspot.com/

  • by the numbers, how can I convert a start time and end in hours time

    I convert my files to Excel, and no to not translate my formulas.

    I have a start time, end time, and hours, what formula should I use to have hours to calculate?

    Thanks for any help

    by the numbers, you can perform mathematical operations on time like this... assuming they are valid values for date/time...

    Assuming that one time is in cell A1 and the other is in A2, you can get the difference like this:

    = dur2hours(a1-a2)

  • Differences in time between the start date and end Date

    I have a requirement to get the difference between the two dates, I am on the syntax below to fill, but it does not work. The syntax is the following:
    TimestampDiff (SQL_TSI_MONTH, "[< dStart_Date_ITAG >]", '[< dEnd_Date_ITAG >]'). Could you please help me on this. Thanks in advance

    Olivier

    Hello Roytson,

    I want to enjoy the sytem itself, I mean there are 2 custom fields start date and enddate, my function should take system only do not enter manually.
    could you please develop this thing.

  • Start time and end of timestamp time calculation

    Hi all

    I have an entry below,

    Channel_number GPS_TIME
    581513-05-2013 18:56:46.410000
    581513-05-2013 18:56:47.410000
    581513-05-2013 18:56:48.410000
    581513-05-2013 18:56:49.410000
    578013-05-2013 18:56:49.510000
    578013-05-2013 18:56:50.410000
    578013-05-2013 18:56:51.410000
    581513-05-2013 18:56:51.510000
    581513-05-2013 18:56:52.410000

    I'm trying to get the result as below,

    CHANNEL_NUMBER BEGIN_TIME End_time
    581513-05-2013 18:56:46.41000013-05-2013 18:56:49.410000
    578013-05-2013 18:56:49.51000013-05-2013 18:56:51.410000
    581513-05-2013 18:56:51.51000013-05-2013 18:56:52.410000

    Please, help me find it.

    Thank you all

    with

    the_data as

    (select 5815 channel_number to_timestamp ('2013-05-13 18:56:46.410000 ',' yyyy-mm-dd hh24:mi:ss.ff') gps_time of all the double union)

    Select 5815, to_timestamp ('2013-05-13 18:56:47.410000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5815, to_timestamp ('2013-05-13 18:56:48.410000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5815, to_timestamp ('2013-05-13 18:56:49.410000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5780, to_timestamp ('2013-05-13 18:56:49.510000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5780, to_timestamp ('2013-05-13 18:56:50.410000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5780, to_timestamp ('2013-05-13 18:56:51.410000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5815, to_timestamp ('2013-05-13 18:56:51.510000 ',' yyyy-mm-dd hh24:mi:ss.ff') of all the double union

    Select 5815, to_timestamp (' ' 2013-05-13 18:56:52.410000 ',' yyyy-mm-dd hh24:mi:ss.ff ") of the double

    )

    Select channel_number, begin_time, end_time

    from (select gr,

    channel_number,

    FIRST_VALUE (gps_time) on begin_time (gr stopped by gps_time partition),

    FIRST_VALUE (gps_time) on end_time (gr stopped by gps_time desc partition),

    ROW_NUMBER() on rn (gr stopped by gps_time partition)

    from (select channel_number, gps_time,

    ROW_NUMBER() on row_number() (order of gps_time) - on the gr (partition by order of gps_time channel_number)

    of the_data

    )

    )

    where rn = 1

    begin_time order

    CHANNEL_NUMBER BEGIN_TIME END_TIME
    5815 13 MAY 13 06.56.46.410000000 PM 13 MAY 13 06.56.49.410000000 PM
    5780 13 MAY 13 06.56.49.510000000 PM 13 MAY 13 06.56.51.410000000 PM
    5815 13 MAY 13 06.56.51.510000000 PM 13 MAY 13 06.56.52.410000000 PM

    Concerning

    Etbin

    Post edited by: Etbin me or Apex we missed something in the original post

  • Where the start time is put in CC 2014.2?

    Screen Shot 2014-12-28 at 16.35.27.pngCannot find the start time for the timecode in my last version of first.

    Thank you

    Phil

    Found, sound in the tab sequence rightklik and there it is.

  • I recently dropped my laptop and it is weird, one day he int open up to 4 start times and sometimes it shows me a folder and a question mark in the interface and sometimes asked to reset my password, what are the steps to take?

    I recently dropped my laptop and it is weird, one day he int open up to 4 start times and sometimes it shows me a folder and a question mark in the interface and sometimes asked to reset my password, what are the steps to take?

    Anything can be corrupted on your MacBook Pro, but from what you say, it seems that the cable drive/SSD/flash memory/SATA hard was seriously damaged. Him "question mark" means that your Mac is unable to find any bootable device, meaning that it does not yet detect your OS X drive.

    You should make a backup of your files (if you can still do it) and take the Mac at the Apple Store or dealer to get a diagnosis. There may be several damaged parts.

  • How to set the start time of QuickTime movie in AppleScript?

    I've been tasked with finding a way to play videos to QuickTime in full screen at a specific time.

    It seems that I have to use AppleScript, which I've never used it before.  I wrote this, that does everything, but from the beginning of time says:

    Tell application "QuickTime Player"

    Open the file "Macintosh Users:...: video56.mp4.

    present the document before

    play

    tell the end

    I found the dictionary AppleScript of QT (1. Open the Script Editor. 2. Choose file > open dictionary. 3. Select the reader QuickTime Player.) and think I want to use the document, currently.

    Where I'm stuck, but I can't understand how to use the document command.  All other orders that I used (open game) end in a 'v' and the document ends with a 'n', which is probably relevant.  How, I have no idea.

    Thanks in advance for any help!

    El Capitan 10.11.3 OSX

    21.5 "iMac late 2009

    QT worm 10.4 (855)

    Hello

    The script must set the current time property of the document, like this

    ------------

    Tell application "QuickTime Player"

    set tDoc to open the file "Macintosh Users:...: video56.mp4.

    tDoc said

    at the time current 36 - the start time of the movie (in seconds).

    present

    play

    tell the end

    tell the end

    -----------

    Shortman43 wrote:

    I found the dictionary AppleScript of QT (1. Open the Script Editor. 2. Choose file > open dictionary. 3. Select the reader QuickTime Player.) and think I want to use the document, currently.

    Where I'm stuck, but I can't understand how to use the document command.  All other orders that I used (open game) end in a 'v' and the document ends with a 'n', which is probably relevant.  How, I have no idea.

    The v designates a file object.

    And the n is a document object.

    Examples:

    read the document 1

    document before playing

    read the document 2

    play tDoc - the tDoc variable contains a document object

    or with a block of tell

    tDoc said

    play

    tell the end

    tell document before

    play

    tell the end

  • Windows cannot find C:\WINDOWS\system32\rundll.exe. Make sure you typed the name correstly and then try again. To search for a file check the Start button and then click search.

    I tried to launch my Spysweeper and found that is not there, then I re downloaded and I could not install it because it was already on my computer.  I went to the control panel to remove and got the message:

    Windows cannot find C:\WINDOWS\system32\rundll32.exe.  Make sure you typed the name correctly and then try again.  To search for a file, select the Start button and then check the search...

    What should I do?

    Hi gsrow,

    You can go there!

    Cannot find the Rundll32.exe file when you open the control panel:
    http://support.Microsoft.com/kb/812340

    Alternatively, copy the folder C:\Windows\System32\DllCache Rundll32.exe file to the System32 folder. Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]

  • My win xp sp3 displays this error 0X000000F4 (0 x 00000003, 0X80ED4020, 0X80ED4194, 0X805D2970) in the start time menu some time pc works without error after 2 or 3 p.m. shows this message what solution help me please

    My win xp sp3 displays this error 0X000000F4 (0 x 00000003, 0X80ED4020, 0X80ED4194, 0X805D2970) in the start time menu some time pc works without error after 2 or 3 p.m. shows this message what solution help me please

    This problem is solved replaced smps problem is resolved. Maybe the smps is not given the correct voltage

  • How do you find the last time that an address older Windows Live Hotmail has been used if you don't remember the password?

    How do you find the last time an old hotmail address was used... especially if you can't remember the exact password?

    original title: old hotmail address

    How do you find the last time an old hotmail address was used... especially if you can't remember the exact password?

    Good enough if you can't on the account and you can't prove it is yours in order to regain access (via password self-service reset, etc)-then you won't know anything about the account.

  • Web page cannot find the start page

    We built the website Muse and host on catalyst for business it worked great. We are now receiving message when trying to connect to the web page saying Safari can find the start page. Also, we do not get mail through site. We did not any changes to the site. We update Adobe muse app but did not site. Thanks for any help in advance

    Kevin

    Connect to the catalyst for business admin--> go to Site---> Select site areas settings---> select the domain name from the list and click on manage---> choose your homepage...

  • In EPMA: What is the difference between the dimensions time and periods?

    In EPMA: What is the difference between the dimensions time and periods?

    The time dimension, I believe only applies to the epma essbase dimensions and creates a time dimension essbase.
    The period dimension can be applied to planning, essbase, consolidation.

    So if you create an application of epma essbase and want the functionality of a time dimension, then you create a time dimension.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • I can't find the start icon to restart anywhere and it used to be here.

    Used to be in the lower left corner of the start icon and also a menu to the sidebar with start option to the right of the screen.

    8.1 Windows startup icon is hidden?

    If the area of Firefox toolbar does not appear, Firefox may be full-screen mode. The F11 key toggles between normal display and full-screen.

    If the Firefox toolbar is visible, but the Firefox window is too large and does not block the Windows task bar, you can try to resize the Firefox window. Press Alt + space to display the ' in control ' of the Firefox window, then click on size or type s, tap the arrow down on the keyboard, then press the up arrow button repeatedly until you see the task bar, and then press ENTER.

    Who help me?

Maybe you are looking for

  • Is this slim IDE and what is it?

    According to this sitethe ide on the SD-R2412 connector should be like this - SLIM!S D - R 2 4 1 2http://www.Alibaba.com/catalog/10386039/Toshiba_Sd_r2412_Slim_Cdrw_Combo_Drive.html s l i m! and what I expectedhttp://tinyurl.com/3784qu But this isn't

  • HP Support Assistant will not download updates to date, or all the 'health check '.

    Recently, I noticed that my HP Support Assistant continued to inform me of new updates available. In addition, every time I try and do a manual check for updates through the app, the 'health check' will fail. I have a HP Envy 14, edition Audio Beats.

  • IdeaPad 13: Touch not working not not after connecting USB device

    Hi - I use a USB MIDI keyboard (Akai LPK25) with my Ideapad. I have not previously had a problem with this configuration, but since about a week there, as soon as I plug the device touchscreen becomes invalid. Remove the device is not restore functio

  • Help table

    Hello I can't find the thing in the rectangular image below. Please some a navugate.

  • My Pavilion dv6-1325sf crashes whenever I unplugged the charger of the PC

    Please can you help me with this questions please, I do not know why my pc slows down or should I say crashes whenever I unplug the charger from the PC... Please any idea how solve this problem...? Thank you guys