Date/Time Difference Anomaly in OC4J 9.0.4 Webservices.

Hi all,
We have a very peculiar problem with certain Dates in OC4J webservice. We checked the date on the client before it gets sent to the server and when the server (webservice) receives it, it's off by 1 hour, and vice versa. The strange thing is that it doesn't do it to all dates. Only some dates. Seems like most recent dates like those that occur this year or last year are ok. Yes, we checked timezones, daylight savings, clocks, etc, on both client and server and they are the same. Besides if it's something that global, it'll affect all dates not just certain dates.
We tested it against a Linux box running OC4J 9.0.4 and the problem shows up, but when we test it against a Windows box running OC4J 10.1.2, it's fine. We don't know if it's Windows or it's 10.1.2 that fixes it. Also, on the OC4J 10.1.2, it's running on the same box as the client, so that may also be a factor. Upgrading the Linux box to OC4J 10.1.2 is not an option.
Has anyone come across this problem before ? If so, any fixes/patches ? If we can find and prove evidence that this problem goes away in 10.1.2, we might be able to persuade the IT dept to upgrade to 10.1.2.
We're using JDeveloper 10.1.2 for development with an Oracle 9i database and OC4J 9.0.4 (which we conjectured, is the problem).
Thanks.
JH

I'm guessing by now you've determined the cause and taken steps to correct the problem ... was wondering what you found and how you resolved it. We just came across the exact same problem this morning and I'm having little luck finding information. :( I suspect OC4J is "adjusting" the time for us (gee thanks), but we are using v 9.0.2.1so your version theory could be it as well. At any rate, I would certainly appreciate your input JH. Thanks in advance!

Similar Messages

  • Date/Time difference based on working days

    Hi Guru's,
           I am having a problem getting the difference between two timestamps. A normal difference between 2 timestamps is possible however i would like to calculate the hour difference between 2 timestamps excluding public holidays, weekends and also after office hours. Is there a series of FM or a logic to extract this kind of info. Hope you guys can shed some light into the matter.
    Thanks in advance.
    Anand

    Hi,
    Use FM DATE_COMPUTE_DAY. DATE in MM/DD/YYYY format.
    This FM returns the date in form of weekday number ie the date which you give is tuesday then it will return 2.
    Give call log date and call handled date.
    eg A call is logded on tuesday 3.00 pm and handled on Thursday 10.a.m.
    First check the days difference from the return of this FM.
    IF the call handled date return - call loged date return is positive means no sat sun , if negative means sat and sun.
    then from call logged date time start counting the office hours till call handled time.
    Office hours can be easily calculated using 24 hours clock.
    For public holidays have to check whether between the twodates any public holiday if is there then subtract that much office hours.
    Hope this helps.
    Thanks,
    Niketa

  • Calculate Date/Time Difference in a Calculated Column Omitting Weekends, Holidays and Non-Working Hours

    I am looking for a formula to use in a calculated column that calculates the difference between two date/time fields while excluding weekends, holidays and non-working hours
    6/1/2010 9:43 AM - 6/7/2010 1:45 PM
    Here is the closest that I have gotten; however, this formula gives me a result of 96:
    =IF(AND((WEEKDAY([Resolved Date],2))<(WEEKDAY(Created,2)),((WEEKDAY(Created,2))-(WEEKDAY([Resolved Date],2)))>1),(((DATEDIF(Created,[Resolved Date],"D")))-(FLOOR((DATEDIF(Created,[Resolved Date],"D")+1)/7,1))-3),(((DATEDIF(Created,[Resolved Date],"D")))-(FLOOR((DATEDIF(Created,[Resolved
    Date],"D")+1)/7,1)*2))*24)
    Any and all assistance is greatly appreciated!

    I don't know how to exclude holidays but i exclude weekends(Sat&Sun)-
    IF(ISERROR(DATEDIF([Start Date],[End Date],”d”)),””,(DATEDIF([Start Date],[End Date],”d”))+1-INT(DATEDIF([Start Date],[End Date],”d”)/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start
    Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End
    Date])=7),1,0))
    -Thanks
    Swapnil

  • I hate to reinvent the wheel - Date/time differences

    Does anyone have a concise SQL algorithm to find the difference between
    2 dates and times where the dates are stored in a date field and the times are stored as a varchar in the format HH:MM:SS (24 hr clock).

    Hi,
    I am using a stored procedure which give calculates the no of days between two dates. Try using/modifying it and see if it is of any help
    The Procedure................
    DECLARE
         vdDateFrom DATE;
         vnDayFrom NUMBER := 0;
         vnMonthFrom NUMBER := 0;
         vnYearFrom NUMBER := 0;
         vdDateTo DATE;
         vnDayTo NUMBER := 0;
         vnMonthTo NUMBER := 0;
         vnYearTo NUMBER := 0;
         vnYearsDiff NUMBER := 0;
         vnMonthsDiff NUMBER := 0;
         vnDaysDiff NUMBER := 0;
         E_STOP EXCEPTION;
    BEGIN
         vdDateFrom := '01/11/2001';
         dbms_output.put_line('Date From: '||vdDateFrom);
         vdDateTo := '17/11/2001';
         dbms_output.put_line('Date To: '||vdDateTo);
         IF vdDateTo < vdDateFrom THEN
              RAISE E_STOP;
         END IF;
         vnDayFrom := to_char(vdDateFrom, 'dd');
         vnMonthFrom := to_char(vdDateFrom, 'mm');
         vnYearFrom := to_char(vdDateFrom, 'yyyy');
         vnDayTo := to_char(vdDateTo, 'dd');
         vnMonthTo := to_char(vdDateTo, 'mm');
         vnYearTo := to_char(vdDateTo, 'yyyy');
         IF vnMonthTo - vnMonthFrom < 0 THEN
              vnYearsDiff := vnYearTo - vnYearFrom - 1;
         ELSIF vnMonthTo - vnMonthFrom > 0 THEN
              vnYearsDiff := vnYearTo - vnYearFrom;
         ELSE
              IF vnDayTo - vnDayFrom >= 0 THEN
                   vnYearsDiff := vnYearTo - vnYearFrom;
              ELSIF
                   vnDayTo - vnDayFrom < 0 THEN
                   vnYearsDiff := vnYearTo - vnYearFrom - 1;
              END IF;
         END IF;
         dbms_output.put_line('Years: '||vnYearsDiff);
         IF vnMonthTo - vnMonthFrom < 0 THEN
              IF vnDayTo - vnDayFrom >= 0 THEN
                   vnMonthsDiff := 12 + vnMonthTo - vnMonthFrom;
              ELSIF
                   vnDayTo - vnDayFrom < 0 THEN
                   vnMonthsDiff := 12 + vnMonthTo - vnMonthFrom - 1;
              END IF;
         ELSIF vnMonthTo - vnMonthFrom = 0 THEN
              IF vnDayTo - vnDayFrom >= 0 THEN
                   vnMonthsDiff := 0;
              ELSIF
                   vnDayTo - vnDayFrom < 0 THEN
                   vnMonthsDiff := 11;
              END IF;
         ELSE
              IF vnDayTo - vnDayFrom >= 0 THEN
                   vnMonthsDiff := vnMonthTo - vnMonthFrom;
              ELSIF
                   vnDayTo - vnDayFrom < 0 THEN
                   vnMonthsDiff := vnMonthTo - vnMonthFrom - 1;
              END IF;
         END IF;
         dbms_output.put_line('Months: '||vnMonthsDiff);
         IF vnMonthFrom = vnMonthTo THEN
              vnDaysDiff := vnDayTo - vnDayFrom;
         IF vnDaysDiff < 0 THEN
         vnDaysDiff := to_char(last_day(add_months(vdDateTo,-1)),'dd') - vnDayFrom;
                   IF vnDaysDiff < 0 THEN
                        vnDaysDiff := vnDayTo;
                   ELSIF vnDaysDiff >= 0 THEN
                        vnDaysDiff := vnDaysDiff + vnDayTo;
                   END IF;
         END IF;
         ELSE
              vnDaysDiff := vnDayTo - vnDayFrom;
         IF vnDaysDiff < 0 THEN
         vnDaysDiff := to_char(last_day(add_months(vdDateTo,-1)),'dd') - vnDayFrom;
                   IF vnDaysDiff < 0 THEN
                        vnDaysDiff := vnDayTo;
                   ELSIF vnDaysDiff >= 0 THEN
                        vnDaysDiff := vnDaysDiff + vnDayTo;
                   END IF;
         END IF;
         END IF;
         dbms_output.put_line('Days: '||vnDaysDiff);
    EXCEPTION
         WHEN E_STOP THEN
         dbms_output.put_line('Error: Date To is less than Date From.');
    END;
    Regards
    Dinesh

  • Function Module for Date/ Time difference in Working Days

    Hi all,
    Are there any function modules which will calculate the difference between a date AND time, but in working days?
    I can use the FIMA_DAYS_BETWEEN_TWO_DATES_2 FM for the dates, but I need to include times in this as well.
    This is for situations where the 'starting date' is a non-working day, and the 'end date' is a working day.  In this situation I need to take all the hours and minutes into account, which happened on the working day.  To give an example -
    Start date:  04.07.2010 (Sunday - Non working day)
    Start time:  21:12:36
    End date:  05.07.2010 (Monday - Working day)
    End time:  04:47:24
    I realise there is a Time option in this function module, but when I test it, it doesn't seem to be returning the desired results (returns 0 for days and time).  I am using '5' as the I_STGMETH and 'GB' as the I_SKALID. 
    I need a calcuation which will return the time, post midnight on the working day - in this example, 4 hours, 47 minutes (seconds are optional!).
    Can anyone help? - can I still use FIMA_DAYS_BETWEEN_TWO_DATES_2 but with different parameters?
    Thanks
    Mischa
    Edited by: Mischa Gulseven on Jul 20, 2010 10:40 AM

    Hi,
    Thanks but this FM does not seem to account for working days.
    For example, if I use:
    DATE1                           04.07.2010  (non working day)
    TIME1                           04:00:00
    DATE2                           05.07.2010   (working day)
    TIME2                           21:00:00
    It will give the following results -
    DATEDIFF                                                      1
    TIMEDIFF                                                     17
    EARLIEST                        1
    I don't want to account for the non-working day so the result I actually want would be to calculate from midnight on 05.07 to 21:00 on 05.07 which should be 21 hours.
    I suspect I probably need to include the STGMETH and the factory calendar somewhere in the FM?
    Does such a FM exist, or could anyone help me with some ABAP for this?
    thanks
    Mischa

  • Date Time Difference

    Post Author: mrae
    CA Forum: Formula
    I searched for similar topics in this forum and tried several of the formulas but was unsuccessful.  What I'm trying to get is how long from the time a work is requested to the time it's assigned.  So I have to get this information from 4 fields (as the Date and Time are separated):
    Date Requested           Time Requested             Date Assigned             Time Assigned
    1/1/2008 12:00:00 AM    1/01/1900 1:03:00 PM       1/19/2008 5:00:12 AM    1/19/2008 5:00:00 AM
    I tried the DateDiff (intervalType,startDateTime,endDateTime ) and although it gave me the # of days, the hours part does not look right.
    Please help.

    Post Author: mrae
    CA Forum: Formula
    Thanks for your response.   I tried the formula above and was not quite sure if I was doing it correctly.  Since the date and time data I want to capture are in two separate fields (DateRequested and Time Requested), the formula above only has the one field so I tried to insert the Time field by doing this formula below but does not work:
    Local DateTimeVar d1 := ({wrhwr.date_requested}+{wrhwr.time_requested});
    Local DateTimeVar d2 := ({wrcfhwrcf.date_assigned}+{wrcfhwrcf.time_assigned});
    DateDiff ("d", d1, d2) -
    DateDiff ("ww", d1, d2, crSaturday) -
    DateDiff ("ww", d1, d2, crSunday)
    Just as a reference, this is what I get in the Date Field - 1/1/2008 12:00:00AM (note that the time all says 12:00:00AM)
    and this is for the Time Field - 12/30/1899 1:03:00PM (note that all the dates says 12/30/1899).
    Thanks for any help you can give.

  • Date & time  difference in a single column but multiple rows in a table

    hi folks,
    am using Oracle db 10g by chance is there any other way to do my requirement.
    as I stated in my subject.

    You probably need LAG:
    SQL> -- generating sample data (how hard can it be...)
    SQL> with testdata as (
      2  select 200 bno, 32 temperature, to_date('28.05.2012 09:00:00', 'dd.mm.yyyy hh24:mi:ss') dt from
    dual union
      3  select 200, 36,to_date('28.05.2012 15:00:00', 'dd.mm.yyyy hh24:mi:ss') from dual
      4  )
      5  --
      6  -- actual query:
      7  --
      8  select bno
      9  ,      temperature
    10  ,      dt
    11  ,      numtodsinterval(dt-lag(dt) over (partition by bno order by dt), 'day') difference_int
    12  ,      substr((numtodsinterval(dt-lag(dt) over (partition by bno order by dt), 'day')), 12, 8)
    difference_dt
    13  from   testdata;
           BNO TEMPERATURE DT                  DIFFERENCE_INT                 DIFFEREN
           200          32 28-05-2012 09:00:00
           200          36 28-05-2012 15:00:00 +000000000 06:00:00.000000000  06:00:00
    2 rows selected.But, as Paulie already said: still insufficient input. We know nothing about your datatypes. I assumed you're using a DATE.

  • Date-Time Arithmetic

    I'm a long time Excel user.  I want to import a few of my Excel spreadsheets into Numbers so I can then take advantage of iCloud Drive to add data to these particular Numbers spreadsheet from my iPad Air 2 (latest version of IOS 8).  Any modifications to the Numbers spreadsheet will be done on my 2 year old 27" iMac running the latest version of Yosemite and Numbers.
    All my Excel spreadsheets have imported to Numbers without a hitch except the one that uses Date-Time arithmetic.  Excel allows you to put a date in one cell and time in another and to add the two to create a number based on January 1, 1904 as the reference.  This makes it easy to do Date-Time Arithmetic.  As best I can tell you can only do this in Numbers if you enter a date and a time in each cell, which is both cumbersome and time consuming.  I can't seem to find any way around this.  Is there a way to add a date cell to a time cell in Numbers similar to Excel that I haven't found?  Thanks.

    Klavezzo,
    Date-Time values are where Numbers diverges most from Excel in the things that I use frequently. I no longer use Excel, so the differences don't affect me the way they might affect you or others. In Numbers, every Date has a Time associated with it, and every Time has a Date associated with it. They always exist together.
    There are functions to strip out individual elements of the Date-Time value, if you need to: YEAR, MONTH, DAY, HOUR, MINUTE and TIMEVALUE. The first 5 are self explanatory, TIMEVALUE returns the decimal fraction of a day corresponding to the Time portion of the Date-Time value.
    A Duration value can be useful if you prefer not to work in decimal fractions of a day, and it is especially important for Date-Time difference calculations.
    The key things to remember about Date-Time calculations are 1. You can't add two Date-Time values, and 2. The result of a Date-Time subtraction is a Duration, and 3. To add to a Date-Time value, you can either add a Duration or you can add a numeric value of days, and decimal fractions of a day, for the time portion.
    As with most values in Numbers, you can change how a value is displayed with formatting, but you can't change the data type with formatting. The only exception that I can think of is that when a value is formatted as Text. Then it no longer can be manipulated as a value, so it truly is altered internally.
    If you give us some examples of your calculations, we can suggest ways to deal with them in Numbers.
    Jerry

  • How to find the date and time difference in InfoPath 2013?

    Hi All,
    My date and time format is like: 2013-12-24T10:47:38 and have three fields Start date, End date and Actual time taken.
    If start date and end date filled then actual time taken field should automatically should fill, for example 2 days 12 hours 48 min 3 sec.
    How to achieve this?

    Hi Sam,
     I believe we had discussed the same issue in the below thread. Can you please refer the below one?
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d93e16ff-c123-4b36-b60b-60ccd34f6ca7/calculate-time-differences-in-infopath?forum=sharepointcustomizationprevious
    If it's not helping you please let us know
    Sekar - Our life is short, so help others to grow
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • How to get exact date and time difference?

    Hi,
    When i am using the below sql statement:
    SELECT (TO_DATE('7/27/2006 05:00:15 PM','MM/DD/YYYY HH:MI:SS PM') - to_Date('7/27/2006 8:30:13 AM','MM/DD/YYYY HH:MI:SS AM')) * 24 hours FROM DUAL;
    the output is:
    Hours
    8.50055555555556
    But Actually it is 8.30
    So how can i get exact days and time difference between two dates in Oracle?
    Thanks....
    Regards,
    Suman Sakinala
    Edited by: SSN on Sep 19, 2008 1:27 AM

    Or more clearly (this time I have my date_from and date_to the right way around hehe!)
    SQL> ed
    Wrote file afiedt.buf
      1  WITH t as (select TO_DATE('7/27/2006 05:00:15 PM','MM/DD/YYYY HH:MI:SS PM') as dt_to,
      2                    TO_DATE('7/27/2006 08:30:13 AM','MM/DD/YYYY HH:MI:SS AM') as dt_from FROM DUAL)
      3      ,d as (select (dt_to-dt_from)*24 as diff_hrs from t)
      4  -- end of dates
      5  SELECT TRUNC(diff_hrs) as hours
      6        ,TRUNC(((diff_hrs) - TRUNC(diff_hrs))*60) as mins
      7        ,TRUNC(((((diff_hrs) - TRUNC(diff_hrs))*60) - TRUNC(((diff_hrs) - TRUNC(diff_hrs))*60))*60) as secs
      8* FROM d
    SQL> /
         HOURS       MINS       SECS
             8         30          2
    SQL>

  • 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

  • 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!

  • Date formats-time difference

    Hi,
    Any function module which can give the date and time difference if i input the date and time in the following format
    20090322       (date)
    20090321       (date)
    040004 (time)
    040000 (time)
    I had checked the other FM's but those are not in synch with the date format I am giving.Do anyone here know about a FM which can give the time difference even if we input the date and time in the above format.
    Format is the problem I am facing.
    Thanks,

    Hi Folks,
    I just want to avoid all the below computations and expecting to get the result irrespective of whichever the date format is,ie a function module which gives me the time difference irrespective of the date format that is fed as input.Seems it is not possible.
    data:date1(08) type C value '20090322',
         date2(08) type c value '20090322',
         time1(08) type c value '060648',
         time2(08) type c value '062403',
         date3(08) type C,
         date4(08) type c,
         time3(08) type c,
         time4(08) type c,
         temp1(08) type C,
         temp2(08) type c,
         temp3(08) type c,
         temp4(08) type c,
         temp5(08) type C,
         temp6(08) type c,
         temp7(08) type c,
         temp8(08) type c,
         temp9(08) type c,
         temp10(08) type c,
         temp11(08) type c,
         temp12(08) type c,
         gpdt type d,
         gptm type t,
         smsdt type d,
         smstm type t,
         e_tdiff type cva_time,
         v_diff type cva_time,
         e_days type i.
    temp1 = date1+0(4). "year
    temp2 = date1+4(2)."month
    temp3 = date1+6(2). "date
    temp4 = time1+0(2)."hrs
    temp5 = time1+2(2)."mins
    temp6 = time1+4(2)."secs
    temp7 = date2+0(4). "year
    temp8 = date2+4(2)."month
    temp9 = date2+6(2). "date
    temp10 = time2+0(2)."hrs
    temp11 = time2+2(2)."mins
    temp12 = time2+4(2)."secs
    concatenate: temp3  temp2  temp1 into gpdt,
                  temp9  temp8  temp7 into smsdt,
                  temp4  temp5  temp6 into gptm,
                  temp10  temp11  temp12 into smstm.
    CALL FUNCTION 'SCOV_TIME_DIFF'
      EXPORTING
        im_date1                    = gpdt
        im_date2                    = smsdt
        im_time1                    = gptm
        im_time2                    = smstm
    IMPORTING
       EX_DAYS                     = e_days
       EX_TIME                     = e_tdiff
    * EXCEPTIONS
    *   START_LARGER_THAN_END       = 1
    *   OTHERS                      = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write:/ e_tdiff,
            e_days.
    Thanks,

  • How to calculate the Time difference between 2 dates

    HI All,
    I am using HR_hk_diff_btw_2_dates to calculate the employee service dates.
    For that i  am inputing his hire date and Term dates and Output format as '05' i am getting output perfectly....
    But problem is  whe i am inputting the employee hire date is Dec 1 2007 and Term date is
    March 31 2009 It is coming as 1 year 3 months  31 days instead of 1 year 4 months directly .......How could we make it make last date also working day and get the O/p as 1 year 4 months ?Please Advice..
    Regard
    sas

    1. FM for difference betwwen two times:SCOV_TIME_DIFF
    Import parameters               Value
    IM_DATE1                        2008-01-01
    IM_DATE2                        2008-01-01
    IM_TIME1                        10:00:00
    IM_TIME2                        11:30:00
    Export parameters               Value
    EX_DAYS                         0
    EX_TIME                         01:30:00
    2. SD_CALC_DURATION_FROM_DATETIME : Finds the difference between two date/time and report the difference in hours
    L_MC_TIME_DIFFERENCE : Finds the time difference between two date/time

  • 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.

Maybe you are looking for

  • Table/div problem with IE

    I am building a 'planner' in a table and it looks okay in Firefox but not in IE. It's a work in progress but IE doesn't allow the table to align properly and help would be appreciated. Also, the table and left menu reside in a div (container2) which

  • I am unable to purchase my ibook as it says i don't have pictures on certain frames, but have pics on every frame how do i move forward to buy?

    I am unable to purchase my iphoto book I composed, as it says i don't have pictures on every frame, but there are according to layout specifications??

  • Lost Power - Now Project Won't Open!

    I'm working on an iMac (10.10.2) with an external hard drive. I was working on the project and some construction next door caused the power to go out. Now the project won't open. Every time I try to open it, the program crashes. I can open other proj

  • Video Flicker

    We are using adobe production premium cs6, this being used on Mac pro, lion os 10.7.4 with matrox mx02 max card. We facing a Video flicker issue on clips captured using VTR or clips taken as data to adobe premiere? Please advise how we can overcome t

  • ESS upgrade issues

    Hi All, Just wanted understand, if there had been any issues or major concerns during the ESS business package upgrade from 50.x to 60.x or 60.x to 1.0 Regards, DJ