Need Help to calculate difference between times

Hello everyone,
I have two fields which just stores the time in 24 hour format ex: 08:00 and 20:00 now I want to calculate difference between the two times
Kindle help me
Thanks for your help
Thanks
Ravi

Are your fields of varchar2 datatype or...?
Is 08:00 the start time or 20:00?
Date arithmetic is pretty simple in Oracle if you use the right datatype.
See:
http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551242712657900129
Assuming you are storing strings:
SQL> -- generating sample data:
SQL> with t as (
  2  select '08:00' btime, '20:00' etime from dual
  3  )
  4  --
  5  -- actual query:
  6  --
  7  select numtodsinterval(to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'), 'day') nti
  8  ,      (to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'))*24 dt
  9  from   t;
NTI                                                                                 DT
+000000000 12:00:00.000000000                                                       12
1 row selected.
SQL>

Similar Messages

  • Calculate difference between two dates/times

    Hi all,
    Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.
    I need to know how many millisconde(second,minutes, hours... )there is between these two times.
    Please, It is urgent
    Thank you all.
    Karim

    hi,
    try the following function
    CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'        
          EXPORTING                                  
               timestamp1 = timestamp1               
               timestamp2 = timestamp2               
          IMPORTING                                  
               difference = diff                     
          EXCEPTIONS                                 
               OTHERS     = 1. 
    the above function gives the difference in seconds...
    try the following  code to set the resolution to milliseconds..
    SET RUN TIME CLOCK RESOLUTION LOW
    check the thread for details:
    SET RUN TIME CLOCK RESOLUTION?
    all the best!!!
    Regards,
    Aparna

  • How do you calculate difference in time (hours and minutes) between 2 two date/time fields?

    Have trouble creating formula using FormCalc that will calculate difference in time (hours and minutes) from a Start Date/Time field and End Date/Time field. 
    I am using to automatically calculate total time in hours and minutes only of an equipment outage based on a user entered start date and time and end date and time. 
    For example a user enters start date/time of an equipment outage as 14-Oct-12 08:12 AM and then enters an end date/time of the outage of 15-Oct-12 01:48 PM.  I need a return that automatically calculates total time in hours and minutes of the equipment outage.
    Thanks Chris

    Hi,
    In JavaScript you could do something like;
    var DateTimeRegex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d)/;
    var d1 = DateTimeRegex.exec(DateTimeField1.rawValue);
    if (d1 !== null)
        var fromDate = new Date(d1[1], d1[2]-1, d1[3], d1[4], d1[5]);
    var d2 = DateTimeRegex.exec(DateTimeField2.rawValue);
    if (d2 !== null)
        var toDate = new Date(d2[1], d2[2]-1, d2[3], d2[4], d2[5]);
    const millisecondsPerMinute = 1000 * 60;
    const millisecondsPerHour = millisecondsPerMinute * 60;
    const millisecondsPerDay = millisecondsPerHour * 24;
    var interval = toDate.getTime() - fromDate.getTime();
    var days = Math.floor(interval / millisecondsPerDay );
    interval = interval - (days * millisecondsPerDay );
    var hours = Math.floor(interval / millisecondsPerHour );
    interval = interval - (hours * millisecondsPerHour );
    var minutes = Math.floor(interval / millisecondsPerMinute );
    console.println(days + " days, " + hours + " hours, " + minutes + " minutes");
    This assumes that the values in DateTimeField1 and DateTimeField2 are valid, which means the rawValue will be in a format like 2009-03-15T18:15
    Regards
    Bruce

  • How to calculate difference between date in hours?

    Hi All.
    I need calculate difference between first and last date. I'm using the code below:
    int differenceDate = CalendarRule.elapsedDays(fromDate : myFirstDate, toDate : myLastDate);
    This code return an result in days. But I need that result was in hours.
    Has anybody help me?

    Interval dif;
    dif = myLastDate - myfirstDate;
    display((dif.hours));
    Hope it helps

  • Difference between Time Management and Time Evaluation

    Hello
    Is there any Difference between Time Management and Time Evaluation? if yes, then what is it? I guess there's no diff, time evaluation is a report..
    please advice
    Thanks

    Hi Charlene,
    Time management can be divided into 3 steps
    1.Time Recording
    2.Time Evaluation
    3. Planning
    Time Evaluation :
    The recorded time data is grouped and converted to wage types which can be used by payroll for compensation.SAP provides a time evaluation program RPTIME00 for this purpose.
    Standard schemas TM00 and TM04 are used for evaluation of time data got from positive and negative time recording approaches.
    time evaluation program RPTIME00 also calculates accrual and entitlement for employees.
    Regards,
    Swapnil

  • I need help syncing my contacts between Outlook and iPhone using iTunes. I followed the steps given and ended up with just email addresses showing in my contacts even though I have phone numbers and snail mail in my Outlook Contacts. Using  Windows 7

    I need help syncing my contacts between Outlook and iPhone using iTunes. I used the knowldge document and set it up to transfer my Outlook contacts to the iphone using itunes.
    In contacts on the iphone I only see the email addresses.
    Yet in Outlook I have email, snail mail and phone numbers.
    I followed the knowledge document from iphone.
    I did it once, didn't work so deleted all the contacts from the phone and tried again. Same result. I have a PC using Windows 7 64 bit.

    You can't access an Exchange account via ActiveSync with the Address Book and iCal on your Mac.
    You can access a MM account with Outlook on your PC at work and keep your MM email account server stored mailboxes synced between your PC at work, your iPhone, and the MM "cloud". Not sure about syncing MM contact info and calendar events with Outlook at the same time with an Exchange account.
    This will not provide for syncing your Exchange account contact info and calendar events with the Addresss Book and iCal on your Mac because the accounts are separate.
    You can access an Exchange account and a MM account at the same time with the iPhone's mail client, and sync contact info and calendar events over the air with both accounts at the same time. You can view combined contact info or separately for each account, and the same for calendar events.

  • Difference between Timer.stop() and Timer.reset()?

    Hello,
    What is the difference between Timer.stop() and Timer.reset()
    functions because it seems that the 2 functions do the same thing?
    I image Timer.stop() to stop the timer and when Timer.start() is
    called the timer starts from where it stopped. For example, if I
    have a 3 sec. timer (3000 ms). If I stop the timer after 2.5 sec.
    and start the timer again, I would expect the timer to expire/trip
    within .5 sec. Is this a correct assumption?
    Thanks,
    Nilang

    Hello,
    Here is a better description of what I am trying to do and
    the problem I encountered.
    I am developing an application that plays multiple sound
    files at different time offsets. For example, snd1 starts at time
    offset 0 and snd2 starts at time offset 5000 ms (5 sec). I have
    created a timer for each sound file and enabled the handlers via
    addEventListener() function. I encounter a problem after the timer
    has been stopped (Stop button pressed) before the timer expires.
    When the user presses the Play Button, the timer seems to be reset
    because the onTimerComplete() function is triggered after an
    additional 5000 ms (5 sec). Is this normal behavior? If this is not
    the correct behavior, is there a workaround Any help would be
    appreciated.
    I have created a small application in Flash CS3 that depicts
    the problem with just a single sound file. I have Flash Player
    9.0.124.0 installed. Sample code is above.
    Thanks,
    Nilang

  • What's the Difference between Time Capsule and OS X Server?

    The only thing i know is that both of them can share and backup files among different computers.
    is that correct?
    I'm still not quite understanding the exact functions of them
    so your help and explanation will be highly appreciated.!!
    Thanks!

    Did i do something to cast your anger upon me o mighty Camelot, backed up bypterobyte?
    Not at all, Mark - at least not in my case. I'm sorry if it came over that way. I was just saying that there's a slew of differences between Time Capsule and Mac OS X Server - it's almost unfair to put them in the same bucket.
    Yes, Mac OS X Server can act as a backup destination for Time Machine clients, but it can also do a lot more than that. To be fair, it wasn't clear from the original post whether the focus was on backups alone (in which case the two are reasonably similar), but my point was that Mac OS X Server is a whole different animal. It's like comparing a Smart Car and an RV - both will get you from point A to point B, but the RV has bathroom, shower, beds, satellite TV, a kitchen, etc.

  • Difference between Time Capsule 2009 and 2011

    What is the spec difference between Time Capsule 2009 and 2011?  I am looking at refurbished Time Capsules and the discriptions dont really help me.
    • 2 TB, w/Simultaneous Dual-Band Wi-Fi, Originally released October 2009 – $249 CAD
    • 2 TB, Originally released June 2011 – $259 CAD
    tnx

    jizzlets wrote:
    I dont get what the "Simultaneous Dual-Band WIFI" means.  Is that a good thing?
    Means it uses both 2.4ghz band and 5ghz at the same time.. Most N wireless is 2.4ghz.. some can do either 2.4 or 5ghz.. but not at the same time.. TC can do both at the same time. It is a good thing.
    Also, is it a good thing that it has been used 6-12 months?
    No, it is not good.. but you have no idea of the history of the product. For a time capsule that matters. If it has been used for 12months, that comes off the lifespan at the other end.
    For what you save buying new might be well worth it.

  • Need Help in Customization of OTL Time Keeper Layout for Projects.

    Hi All,
    Need help in customization of OTL Time Keeper.
    Requirement:
    Required to change the Project Layout Template as Payroll Layout Template.
    In Payroll Layout Template the days consits of start and end time and total time per day.
    Similary need to reproduce the same content Layout as it is in Payroll.
    Can Anybody suggest the procedure to achive this task
    Thanks and Regards,
    Chaitanya.

    Hi,
    Can someone please Help me on this ...
    Regards,
    Tarun

  • What's the difference between time capsule and time machine?

    What is the difference between time capsule and time machine?

    See Using Time Machine with a Time Capsule.

  • Difference between Time dimension and product(regular) dimenstion

    Hi All,
    I would like to know what is the difference between time dimenstiona and regular dimenstion. How can we differentiate and how Oracle bi server knows a dimension
    as Time dimenstion.
    Thanks,

    Hi,
    By using Logical Dimensional Structure and chronological keys it identify time or other types of dim.
    Just double clik time dimension then you can find the
    root type (Time, Ragged and skipped) and for the chronological keys > just double click logical level then select keys tab -- here u can find chronological keys
    Thanks
    Deva

  • Calculate difference between every other time record

    Here's what I have going on.  Users are keeping track of time they work on a project.  Data to be used in contained in two columns.  In the first column they enter "start" or "stop".  In the second column they input the date and time.  So, output would look something like this:
    start     1/1/2011 3:30pm
    stop     1/1/2011 3:35pm
    start     1/2/2011 1:00pm
    stop     1/2/2011 1:30pm
    start     1/2/2011 2:00pm
    stop     1/2/2011 2:18pm
    I need to be able to calculate the difference between the start and stop time and then create a running total of those time.  Running total not an issue but what can I do to calculate the time difference between start and stop?  Been awhile since I used Crystal (about 5 years) so I've forgotten way too much.  Another issue that I'm running into is that sometimes the users forget to enter the start or stop, so I might have two stops in a row (with one missing the start time) or two starts in a row.  I'm not completely sure how I want to handle those yet.  I may just throw those records out but not certain how I'll do that yet.
    Sorry if this is a bit basic.  Trying to relearn Crystal again - oh, and it's crystal reports 10.

    Here are a couple of formulas that should help you out.
    This will calc the time diff between sequential start and end times
    WhilePrintingRecords;
    Global DateTimeVar x := IF {TableName.Type} = "start" THEN {TableName.TimeStamp} ELSE x;
    Local DateTimeVar y := {TableName.TimeStamp};
    Local NumberVar z:= IF {TableName.Type} = "start" THEN 0 ELSE DateDiff("n", x, y);
    And this one will provide a manual running total
    WhilePrintingRecords;
    Global DateTimeVar x := IF {TableName.Type} = "start" THEN {TableName.TimeStamp} ELSE x;
    Local DateTimeVar y := {TableName.TimeStamp};
    Global NumberVar z:= z + IF {TableName.Type} = "start" THEN 0 ELSE DateDiff("n", x, y);
    Note that you'll want to sort  the records by the "TimeStamp"
    HTH,
    Jason

  • Behaviour's difference between Time Capsule and Airport Extreme + Ext HDD ?

    Hello !
    I would like to know if there is any behaviour's difference between a Time Capsule and an Airport Extreme base station + External HDD ? For instance, once Time Machine configured, have I to mount manually the drive connected to the Airport Extreme to trigger the backup ? Or once my wifi is up, TIme Machine detects the Airport Extreme base station, the hard disk, and triggers the backup ?
    Regards,
    Mr Lejeune

    Theoretically there is no difference between the two. In reality there are two differences. First, Apple does not officially support Time Machine backups on a drive connected to the AEBS. If you run into technical difficulties you'll get no help from AppleCare techs nor from an Apple genius. Second, my experience suggests that it is a fragile backup backup system. My wife is using a TC at work whilst I have a base station and hard drive connected to it at home. Both of us have MacBooks, have the same software, and have the same basic habits. In a three month period I experienced frequent stalled backups - the last one fatal. After numerous attempts to get the backup going again I was forced to format the drive and start over. When I started over, having verified that the backup was working again, I abandoned TM and began backing up wirelessly using ChronoSync. My wife had fewer stalled backups (not none, but fewer) and thus far, nearly a year later, she has never had to format and start over.
    In theory, wireless backup with TM is a great idea but its execution presently leave something to be desired. Frankly, while I am using TM to backup to a tethered hard drive and I'm beginning to trust it despite being a version 1 product, I wouldn't rely on TC and TM as my sole backup scheme.

  • Difference between time

    Hi
    I have text field in form in which I am displaying current time of machine and updating this time using timer trigger after every one second. I have another field in which I want to display time difference between system time and say time '08:30:00 AM'. suppose system time is '08:00:00' then this text must has '00:30:00' in it.
    Thankd

    It is not a good idea to have a one-second repeating timer in any form. The timer will get in the way of processing you really need to do.
    Most computers display the time on the screen already, so you are not providing a useful service to your users.
    However, if you are just doing this to get experience working on Forms, then go for it.
    To add or subtract an hour from Sysdate, you would use the fraction 1/24 (one 24th of a day).   Try this in SQL Plus:
        Select to_char( sysdate - 3/24, 'hh24:mi:ss' ) from dual;

Maybe you are looking for

  • Factory Instantiation Problem when publishing WSDL in Service Registry

    I have installed SOA Suite 10.1.3.1 and OSR 10.1.3. and am trying to publish a WSDL for a new business created as admin. This causes an UDDI error, though: "Invalid WSDL location! WSDLException: faultCode=CONFIGURATION_ERROR: Problem instantiating fa

  • What does this error message even MEAN??

    So as I've been posting on here recently, I'm in the process of upgrading the OS on my old G4 from Panther to Tiger. I've received 2 different suggestions on how to safely do so (the 1st was simply to install Tiger on the 2nd partition of my internal

  • My Appp update button shows new update program totals, but whe I click update, I get a blank screen

    My app update button does not bring up the progams to be update in itunes update

  • Strange signature behavior

    My question concerns changing my signature. I have several signatures set up for different situations. If I begin a brand-new message, I can decide to change which signature I'm using at any point in the creation of that message. However, if I'm repl

  • DM - No Playlists shown

    I have DM 1.0.1 on Snow Leopard 10.6.2 with iTunes 9.0.2 and DM doesn't show any playlists. However, its knows they are there because when I click sync, it starts to re-sync the music. I want to change with playlist it uses though.