DateDiff Help (Need time difference FROM Time 1 TO Time 2 - one direction)

I hope I am putting this in the right section. This is my first post. Thank you all ahead of time for your help.
I am new to both SQL and Report Builder so please bear with me and thank you ahead of time.
I need to find the time difference (in minutes) between Time 1 and Time 2. I've figured out the basics in how to do this but I need the logic to work in ONE DIRECTION. Meaning I need the statement to find the difference STARTING FROM TIME 1 and then ENDING
WITH TIME 2. I need the statement to always assume that Time 1 is FIRST and that Time 2 is LAST.
Here's an example of my results now with a basic DateDiff statement.
Time 1 | Time 2 | Time Difference (in minutes)
11:30 | 1/15/2015 11:50:00 AM | 20
23:50 | 1/15/2015 12:00:00 AM | 1430
23:45 | 1/15/2014 2:05:00 AM | 1300
Please note that Time 1 does NOT have a date at all and came over from its table as a simple 4 digit string so I had to convert it to datetime format using a concatenate statement. If it DID have a date then this probably wouldn't be a problem.
Thoughts?
Thanks.

Thanks, Patrick. I'll look into understanding that (I'm still new to both SQL and Report Builder). Could you explain to me what it does?
I was able to answer my own question only to find that it didn't quite work the way I need it to. I was able to make the logic work so that "if the time is 12AM then change the date for Time 1". However, I ran into another problem and realize that
I ultimately just need to get this to work in one direction. Meaning I need it to find the difference in time STARTING from the Time 1 field TO the Time 2 field. Here's why (using the statement I got to work but only for 12AM):
Time 1 | Time 2 | Time Difference (in minutes)
23:45 | 1/15/2014 2:05:00 AM | -1300

Similar Messages

  • Set-up help needed to print from HPJ4580 via Time Machine

    This should work but I can't seem to make it!
    My HPJ4580 prints fine directly from my MacBook Pro but when I go through the steps to connect and print using the USB connection on the Time Capsule (so my husband and I can both print wirelessly) the printer is not found.
    Any ideas on what I'm doing wrong??
    THANKS!

    OK, so between your helpful prompts and my brain finally operating more satisfactorily I have sorted it.
    Turns out I hadn't selected the proper printer driver - I just selected what looked like the right printer name, which of course was the one I had used from when the printer was connected directly to my computer, hence the wrong location (my MacBook Pro).
    I fixed that by clicking the + button on the bottom left of the list and added the printer again but this time with "Kind' being Bonjour so that it now appears in the available printer list with Time Machine identified as the location.
    Et voila... fully operational!
    Thanks for nudging me along.

  • When I locate my iPad it sends me my email but the time it says in the email is like a 3 hour difference from the actual time I locate what do I do to have the proper time there

    When I locate my iPad it sends me my email but the time it says in the email is like a 3 hour difference from the actual time I locate what do I do to have the proper time there
    My time is correct but email time of location is wrong

    Welcome to the Apple community TMOZINGO.
    If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact AppleCare(or Apple ID Support), upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
    The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
    The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
    Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
    Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
    Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do.

  • W3c duplicate id. Do I really need to start from scratch every time?

    I just ran validation and I got a bunch of warnings about "duplicate id" (duplicate id). You can see my page under construction HERE. I want to repeat the same box over again but with different info/content. Do I really need to start from scratch every time?
    Thank you!

    Use Find & Replace in your source code to change your #ID to a re-usable .class.
    From:  #divName
    to:  .divName
    From:  <div id="divName">
    to:   <div class="divName">
    Nancy O.

  • Help needed in Finding Download location for Sun One Portal 7

    Hi,
    help needed for finding download location for Sun ONE Portal 7. I tried to find in Oracle Download page ,
    http://www.oracle.com/us/sun/sun-products-map-075562.html, But unable to find.
    Please share the link for download location.
    I am totally new in Sun ONE Portal.
    Thanks,
    Edited by: 945439 on Oct 5, 2012 3:41 AM

    try edelivery.oracle.com under sun products.

  • Take out time difference from 2 dates....

    Hi Guys,
    I have two date columns with date datatype in my table.
    Office_Time and Employee_Time, date and time is stored in these columns.
    I want to get the time difference between to dates and times.
    Like if the office_time is 12-MAR-05 09:00:00 and Employee_Time is 12-MAR-05 10:15:00 then the differnce shud be 01:15:00 hours.
    How to apply such a formula.. please help!
    Imran Baig

    Hi,
    You can read the next topic :
    Re: how to get time diff between to date
    Nicolas.

  • Time difference by date by time range - a better way?

    Someone suggested this is a better place for my question:
    Hi
    I need to display the difference in time - every day for different time ranges,
    Example 1-2 pm, 4-5 pm, 7-8 pm. And I need the time difference in 2 dates in the past week for each of these ranges everyday.
    example
    Date Diff Range
    01/01/2007 00:01 1-2pm
    01/02/2007 00:03
    01/03/2007 00:10
    01/04/2007 00:05
    01/05/2007 00:23
    01/01/2007 00:10 4-5pm
    01/02/2007 00:13
    01/03/2007 00:11
    01/04/2007 00:15
    01/05/2007 00:23
    01/01/2007 01:10 7-8pm
    01/02/2007 00:13
    01/03/2007 00:10
    01/04/2007 00:11
    01/05/2007 00:21
    One way to achieve this is to have multiple unions for each day and each time range.
    Example:
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    union
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    union
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    This will give me the required information for only one day - and that is for sysdate-5.
    I will have same nyumber of unions for each day.
    Is there a better way to accomplish the same?
    Any help appreciated.
    Thx!

    Hi
    Sorry for the late response but better late than never:::
    I have gotten the answer of getting data for previous 5 days. I have changed the time between statement and is given below(*).
    Here is a reply to all the questions you had asked in response to my questions.
    What data you have? What parameters are you going to input?
    I have already given sample data in my post.
    There are no input parameters.
    You are talking about the difference - between what is this difference?
    Difference is the difference between 2 timestamp datatypes in 2 different tables (as you may see in the query)
    The field diff - is it varchar2 like '1-2 pm' or what?
    I didnt understand your question. What do you get when you subtract two timestamp datatypes - that should be the datatype - if I have understood your question. Not sure if thats what you asked.
    But IMHO it's impossible to get such a result, of course, if dt_tm in the query is the same as Date in the result!
    The time components in the queries are different. If you see:
    1st Query:...
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    2nd Query:....
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    3rd Query:
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    First should be between 1 and 2 pm for sysdate-5.
    I need starting previous 5 days till sysdate.
    Second is between 4 and 5 pm again for sysdate-5.
    I need starting previous 5 days till sysdate.
    Same with 3rd.
    My final query is something like this:
    select t1.dt_tm, count(t1.id), '1 - 3 am' as period
    from table1 t1, table2 t2
    where t1.id = t2.id
    and dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    group by t1.dt_tm
    union
    select t1.dt_tm, count(t1.id), '4 - 5 pm' as period
    from table1 t1, table2 t2
    where t1.id = t2.id
    and dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    group by t1.dt_tm
    union
    select t1.dt_tm, count(t1.id), '7 -8 pm' as period
    from table1 t1, table2 t2
    where t1.id = t2.id
    and dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    group by t1.dt_tm
    I need for the last 5 days and what i can think of is have 5 different queries for past 5 days and 3 queries per day for the 3 different time periods. This would mean 15 queries. Was wondering if there is a better way to achieve the same?
    Any help appreciated.
    Thx!

  • Converting Time Difference to Human-Readable Time

    Hello everyone,
    I just posted a thread about an hour ago on how to get the difference between the current time and two tables. My results are as follows:
    Call Moddate Modtime Age
    Open     2009-04-09     13:47:08     2.57
    The age is this command:
    round((sysdate - to_date ( moddate | | modtime, 'YYYY-MM-DDHH24:MI:SS'))*1440, 2)
    Is there a way to convert the result (2.57) to a HH24:MI:SS format?

    Hi,
    Solomon Yakobson posted a solution in that other thread that does exactly that.
    with t as (
               select '2009-04-09' ModDate,'13:48:30'  ModTime from dual
    select  numtodsinterval(sysdate - to_date(ModDate || ' ' ||  ModTime,'yyyy-mm-dd hh24:mi:ss'),'day') duration
      from  tIf it produces more output than you'll ever need, use SUBSTR (or some similar function) to get only the part you're interested in.

  • Find time offset from GMT using time zone

    Hi,
    Is there any way i can query the time offset from GMT using the timezone of a place.
    E.g. If I am in India
    My TZNAME is 'Asia/Calcutta' and TZABBREV='IST'
    How can i get the time offset from GMT for this timezone?
    In this case I want +5:30 as the result.
    Regards
    Ravi

    SQL> select dbtimezone
      2  from dual;
    DBTIME
    +01:00
    SQL> Regards,
    Gerd

  • How do i change the number of columns within a text box?  I need to go from three columns to one.

    How do I change the number of columns within a text box?  I need to go from 3 columns to 1.  The insert column is highlighted and column break does not work for this.

    Pages '09 does not seem to allow layout breaks in Textboxes.
    Pages 5.2 has the same limitation.
    Use multiple linked Textboxes in Pages '09 to get the layout you want or create your layout in a Word Processing template in the document layer.
    Peter

  • Urgent help needed! How do I use Time Machine to restore my System disc?

    I need urgent help. First I discovered that my Library folder was empty. When I tried to restore the library to an earlier version via Timemachine it would not let me because it said the system was in use. Trying to start-up from another system on another internal drive and using various disc repairs resulted in the whole volume to disappear.
    Question is how do I get the earlier system from my Timemachine backup drive? I have another Mac where I can attach the TIme machine HD to. Can I restore it from there and then copy the files over to my corrupted disc? All my programs are on there as well, which would take me days to re-install and then there are the other bits, emails, photos etc. Can anyone help?

    lightandmagic wrote:
    Thanks for your sympathy Pondini and the encouragement. You just reminded me that I will lose a whole working day restoring !!! Do you happen to know where the emails are kept on the system and the address book? I better nick those as well as my other life sustaining bits before its too late. I don't trust anything any more.
    I don't know what you mean by "nick those." Time Machine will put everything back the way it was at the time of the backup (unless you'd excluded things).
    Do you mean you want to restore things from the period after the backup you selected?
    For Address Book or Apple Mail, start the application, then +Enter Time Machine,+ navigate to your latest backup, and you'll have a prompt to restore. For Mail, you can restore an entire mailbox. When you exit from TM, you'll see a new folder in your Mail sidebar with the restored items, so you can sift through them and move, delete, or leave them as you wish.
    Other items, you'll have to locate and restore via the Finder > Time Machine.

  • I accidentally renamed all the file names on every single one of my 24000 photos in aperture using batch change ( keywords, metadata etc) Can I undo this action or will I need to restore from an earlier time machine/capsule backup?

    Undoing a batch metadata filename change in Aperture3?

    You're welcome.
    A second copy of the iPhoto library on a second drive is always good. I once lost my backup drive and the system drive at the same time, because a lightning caused a power surge that killed both my macs system drive and the connected backup drive. I was lucky to have a bootable clone of the system drive as a second backup.
    I like this version of the quote you cited:
    A little learning is a dangerous thing;
    drink deep, or taste not the Pierian spring:
    there shallow draughts intoxicate the brain,
    and drinking largely sobers us again.

  • Can someone help me keep Firfox from crashing 50 times a day? Thanks.

    # Question
    Crashing Thread Frame Module Signature [Expand] Source 0 xul.dll GraphWalker::DoWalk xpcom/base/nsCycleCollector.cpp:1237 1 xul.dll GraphWalker::DoWalk xpcom/base/nsCycleCollector.cpp:1233 2 xul.dll GraphWalker::WalkFromRoots xpcom/base/nsCycleCollector.cpp:1221 3 xul.dll nsCycleCollector::BeginCollection xpcom/base/nsCycleCollector.cpp:2565 4 xul.dll XPCCycleCollectGCCallback js/src/xpconnect/src/nsXPConnect.cpp:391 5 js3250.dll js_GC js/src/jsgc.cpp:3537 6 js3250.dll JS_GC js/src/jsapi.cpp:2439 7 xul.dll nsXPConnect::Collect js/src/xpconnect/src/nsXPConnect.cpp:478 8 xul.dll nsCycleCollector::Collect xpcom/base/nsCycleCollector.cpp:2421

    Same here. It's been happening for about a week and nothing has been resolved. This has happen to me in the past with firefox and i'm getting tired of it. I also noticed my memory usage goes threw the roof before it crashes. I have 3.6.13 and i'm using windows xp pro with service pack 3

  • Please help, need to upgrade from 9.2.2 to osx 10.4 Tiger on imac g3 400 dv

    Hello, I would greatly appreciate assistance to upgrade my operating system from 9.2.2 to osx 10.4.10. I have gotten the firmware upgrade installed to 4.1.9. Can anyone tell me what else I need to upgrade to have this computer able to install Tiger 10.4, on an imac g3 400 dv slot loading.....
    Right now when I try to install the disc 10.4 using the option key at restart, it wont load the install disc. Any help would be appreciated , thank u in advance!!!!!!!

    Hi, thank u for responding, my harddrive is 10 gigs, and my memory ram is only 64 megs, I ordered 2 512 mg from 18004memory.com and it didnt work , the computer said there was a memory issue. So I returned the memory back to 18004 memory.com...... I will neve ruse them again , because on their website they stated its guranteed to work and is compliant with imac 400 dv. They stated they will send me another set from another manufacturer, but to return the memory first.....
    I know I meet all the requirements for tiger , except for the ram which apple says I need 256 mg,
    But I was referring to any firmaware upgrades or bios upgrades or any of those type of programming upgrades to ready it for tiger, I know I installed the 4.19, and went from os 9.0 to its current 9.22, I think that alone was 5 upgrades. I think I might be missing an upgrade or maybe not. I will run the utility u posted and thank u for that.....
    Apple told me that I can installl tiger 10.4.10 on this computer.
    The install discs I bought on ebay state imac MAC osx install disc one and there is and install disc 2, it says AHT VERSION 3A127, and dated as produced in the year 2007. it colored grey , but doesnt have the black X like someone else posted it should have
    Oh and it does open the files in 9.22, it does mount, and it does have folders,
    Thank u for ur help as I progress to ultimately saving this imac....
    many thanks!!!!!!!!!!!!!!!!!!

  • Help needed with update from 3GS

    I have an iPhone 3GS and am trying to update the software to ISO 4.. I have followed all the usual steps and connected my iPhone to iTunes and clicked update and all it says is that my iTunes software is up to date at 9.1.. But on the summary page it stills says that my iPhone software is 3.1.. How am I meant to update it? Help!

    You need to click on your device in iTunes to bring up the iPhone summary page. It if from there that you update your iPhone software.
    Message was edited by: gdgmacguy

Maybe you are looking for

  • Goods receipt report by vendor

    Hi, Is there a standard SAP report which sums up the goods receipt for specified materials for a given vendor and a time period? I have tried reports such as MC$4 and MC$G but they show goods receipt quantity for purchase orders which have been creat

  • Basic Authentication for load testing WSDL Web Service

    I'm trying to load test a web service; the WSDL URL is behind a username and password, using the basic http authentication. I can add the WSDL URL without issue with the username and password, but when I playback the script, I get "401 Unauthorized"

  • How to avoid creation of _(file.*), coping from tiger to pc?

    how to avoid the creation of this file for ever on a pc environment?? I explain: as i copy any image file, it goes to a spooler directory and that begins instantly to process the file to an OPI server, separating CMYK channels, converting it to high

  • Size of library and Nano HD question

    So my itunes library is larger than the ipod, so i sync to auto fill with music from the library. I just added some good music to my library and now want that music to be added to the ipod. How do i do a overhaul to the music that is being put on my

  • Styling components

    Can someone give me some general examples of how to apply style to components? I already have components on the stage (so not generating them new from classes in ActionScript). Specifically, I need to designate the display text for both the checkbox