Date difference help!

Hi all,
I have to calculate the difference between two date. It's simply:
data A - date B = days
(20061212 - 20061205 = 7)
but what i have to do if I want the difference without saturday, sanday and all holiday's day (Christmas, etc..)?
In a few words, I need only the working days. Is it possible?
example: if 20061206 is saturday and 20061207 is sunday, then 20061212 - 20061205 = 5
Thanks

Hello,
Use this FM
  CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
       EXPORTING
            I_DATUM_BIS             = G_T_PURO-AEDAT
            I_DATUM_VON             = G_T_EBAN-BADAT
       IMPORTING
            E_TAGE                  = G_F_DIFF
       EXCEPTIONS
            DAYS_METHOD_NOT_DEFINED = 1
            OTHERS                  = 2.
If useful reward.
Vasanth

Similar Messages

  • How we calculate the date difference between two list in SharePoint 2010

    Hi friend's....I have two list first is list1. In this list i have two coulmn start_date and End_date. In second list2 i have two column HolidayName and Holiday_date. Now i want two find the number of day in list1 Excluding Weekend and Holiday_date(that
    column from list2). How i will do ..? Please help me dosto..

    Thanks for reply...
    I have done the date difference in list1. But i want to Exclude the Holiday_date form list2.
    I have list1 - Start_date , End_date, Number_of_day(Exclude weekend and Holiday_date between Start_date and End_date )
    list2 - HolidayName, Holiday_date
    Now how i will calculate the Number_of_day in first list.

  • Query report with date difference.

    Hi Expert,
    I'm using below query to monitor unreleased checks. we have a policy that the holding period for unreleased check is 5 working days.
    SELECT T2.[CardCode], T2.[CardName], T0.[TransId], T0.[DueDate], T1.[Credit], T1.[U_DisBank], T4.[Name], DateDiff(dd,T0.[DueDate],GetDate()) As 'OverDue Days' FROM OJDT T0  INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId  INNER JOIN OCRD T2 ON T1.ShortName = T2.CardCode  INNER JOIN "@HOFFICE"  T4 ON T1.U_Disbank = T4.Code WHERE T1.[Credit] !=0 AND  T0.[DueDate] >=[%0] AND  T0.[DueDate] <=[%1] AND  T1.[balduedeb]+T1.[balduecred] !=0 ORDER BY T4.[Name]
    However I would like to exclude weekends in computing date difference. Can you please help me modify my query code?
    Thanks,
    Arlmi2000

    Hi,
    A simple solution will be change DateDiff(dd,T0.DueDate,GetDate()) to DateDiff(dd,T0.DueDate,GetDate())*5/7+1
    This can cover all the weekends. If you need to be exact that including public holiday, the coding will be  longer.
    Thanks,
    Gordon

  • Date differences if one of the field not presenting

    Hi All,
    I have two attributes start date and end. I have created formula replacement variable.
    some  times one of the field coming as blank, in such acase system writing some garbage value but i need blank.
    How to resolve this issue.
    Reagrds,
    J B

    Hi,
    You can create a new formula in query designer with a condition such that date difference doesn't fall in the invalid value. If it that invalid value put the result as '0'.
    http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/frameset.htm
    If the output is showing as '0' for the invalid values then in the query properties select the Display zeroes as Do Not Display Zeroes.
    http://help.sap.com/saphelp_nw04/helpdata/en/1e/99ea3bd7896f58e10000000a11402f/frameset.htm
    Hope this helps.........
    Rgs,
    Ravikanth.

  • Date difference in one column

    Hi all,
    I need the column DATEDIFFERENCE as per below
    Kindly help me out .
    How to perform on the same column .
    Regards, Subathra

    create table test (id varchar(10), createddate datetime, assigneddate datetime, resolveddate datetime)
    insert into test values ('SD1023','4/2/2014 10:02:00','4/2/2014 10:06:00','6/2/2014 20:06:03')
    insert into test values ('SD1023','4/2/2014 10:02:00','4/2/2014 10:20:01','6/2/2014 20:06:03')
    insert into test values ('SD1023','4/2/2014 10:02:00','4/2/2014 12:02:00','6/2/2014 20:06:03')
    insert into test values ('SD1023','4/2/2014 10:02:00','6/2/2014 20:06:03','6/2/2014 22:10:03')
    insert into test values ('SD10123','6/2/2014 20:06:03','6/2/2014 20:06:03','6/2/2014 23:06:06')
    insert into test values ('SD10123','6/2/2014 20:06:03','6/2/2014 21:06:04','6/2/2014 23:06:06')
    insert into test values ('SD10123','6/2/2014 20:06:03','6/2/2014 22:06:05','6/2/2014 23:06:06')
    insert into test values ('SD10123','6/2/2014 20:06:03','6/2/2014 23:06:06','6/2/2014 23:06:06')
    ;with mycte as (select *,row_number() Over(Partition by id Order by AssignedDate) rn1
    ,row_number() Over(Partition by id Order by AssignedDate DESC) rn2
    from test)
    ,mycte1 as (
    Select m0.id,m0.createddate,m0.assigneddate,m0.resolveddate,
    CASE WHEN m0.rn1=1 Then m0.createddate Else m1.assigneddate End as dt1,
    CASE WHEN m0.rn2=1 Then m0.resolveddate Else m0.assigneddate end as dt2
    from mycte m0 left join mycte m1 on m0.id=m1.id and m0.rn1=m1.rn1+1)
    select id,createddate,assigneddate,resolveddate
    ,datediff(second,dt1,dt2) as [Date Difference in seconds] from mycte1
    order by dt1
    drop table test

  • Date difference in days

    is there any function module to find the difference between two dates , i want the result to be displayed in days.
    eg : days  =  01.01.2006  -  01.01.2005
          days  :  365
    Regards
    Purshoth

    Hi Purru ,
    U  can have another approach to date difference. U can first convert the froamt then take the difference as follows
    1.  To convert Date Format using ABAP
    data lv_date1 type sy-datum.
    data lv_date2(12).
    lv_date1 = '20070123'.
    concatenate lv_date16(2) lv_date14(2) lv_date1+0(4) into lv_date2
    separated by '.' .
    is what you require to do;
    now lv_date2 = 23.01.2007.
    Also look for conversion routine "CONVERSION_EXIT_PDATE_OUTPUT"
    EG: call function CONVERSION_EXIT_PDATE_OUTPUT
                             exporting input = lv_date1
                             importing output = lv_date2.
    Also we can use function module ‘CONVERT_DATE_TO_EXTERNAL’ .
    I hope this helps u out.
    Regards.
    note: Reward if useful

  • Date Difference in SQL Where Condition?

    Dear All,
    I have a problem while fetching records from two tables LIPS and VAPMA on basis of date difference. My SQL conditions/statements are as follows.
    DATA myvar type p.
    1. SELECT SUM( lips~lfimg )
        FROM lips INNER JOIN vapma ON lipsvgbel = vapmavbeln
        AND vapmamatnr = lipsmatnr
        INTO myvar
        WHERE DATEDIFF(lipserdat , vapmaaudat) = 2.
    2. SELECT SUM( lips~lfimg )
        FROM lips INNER JOIN vapma ON lipsvgbel = vapmavbeln
        AND vapmamatnr = lipsmatnr
        INTO mywar
        WHERE
        lipserdat - vapmaaudat = 2.
    Above SQL statements are not working, kindly help me out. Thanking you in advance.
    Ahsan Majeed

    Hi
    Do like this:
    data: begin of itab occurs 0,
               vbeln like lips-vbeln,
               posnr like lips-posnr,
               erdat like sy-datum,
               lfimg like lips-lfimg,
               audat like sy-datum,
               d_diff type i,
         end of itab.
    data : v_qty like lips-lfimg.
    SELECT avbeln aposnr  aerdat alfimg b~audat  into table itab
    FROM lips as a INNER JOIN vapma as b
    ON avgbel = bvbeln.
    clear v_qty.
    sort itab by vbeln posnr.
    loop at itab.
       itab-d_diff = itab-erdat - itab-audat.
      if itab-d_diff = 2.
         v_qty = v_qty + itab-lfimg.
      endif.
    endloop.
    Reward if useful
    regards
    Anji

  • Date Difference in Words

    Hi,
    Want to display the date difference in the following format..
    3 years 2 months 1 days like this.
    Can anybody help me on this..
    Thanks..

    SQL Statement which produced this data:
      SELECT (( (TO_CHAR (TO_DATE (:P_DATE1), 'YYYY')
                      - TO_CHAR (TO_DATE (:P_DATE2), 'YYYY'))
                     || ' Years ')
                     || (ROUND (
                           MONTHS_BETWEEN (TO_DATE (:P_DATE1, 'DD-MM-YYYY'),
                                           TO_DATE (:P_DATE2, 'DD-MM-YYYY')))
                     || ' Months ')
                     || (  TO_DATE (:P_DATE1, 'DD-MM-YYYY')
                         - TO_DATE (:P_DATE2, 'DD-MM-YYYY')
                         || ' Days')
                        )          AS DIFFERENCE
        FROM DUAL
    "DIFFERENCE"
    '1 Year 12 Months 365 Days' Input for the following data :p_date1 is sydate  :p_date2 is '31-05-2012' Edited by: Archana D on May 31, 2013 11:34 AM
    -Added the input parameter values

  • Convert two dates difference to number of years, months and days

    Post Author: gigimonu
    CA Forum: Formula
    I wanted to write a formula (if there is a function I can use) that can convert a date difference to total number of years, months and days example
    adate = 10/22/2006
    ?xdate = current date - adate (answer should be 1 years, 0 months and 0 days)
    Please help
    Thanks

    Post Author: V361
    CA Forum: Formula
    &#91;Years, Months, Days&#93;
    DATEVAR FROMDATE := DATE(2000,01,01); // FROM DATE
    DATEVAR TODATE := CURRENTDATE; // TO DATE
    NUMBERVAR YEARS;
    NUMBERVAR MONTHS;
    NUMBERVAR DAYS;
    STRINGVAR DIFF;
    DATEVAR TEMP;
    IF TODATE < FROMDATE THEN
    (TEMP := TODATE;
    TODATE := FROMDATE;
    FROMDATE := TEMP);
    YEARS := DATEDIFF('YYYY',FROMDATE,TODATE);
    IF YEARS > 2 THEN
    (YEARS := YEARS - 2;
    TEMP := DATE(DATEADD("M",YEARS * 12,FROMDATE));)
    ELSE
    (YEARS := 0;
    TEMP := FROMDATE);
    WHILE TRUE DO
    (TEMP := DATE(DATEADD('M',1,TEMP));
    IF TEMP > TODATE THEN
    EXIT WHILE;
    MONTHS := MONTHS + 1);
    DAYS := DATEDIFF('D',DATE(DATEADD('M',-1,TEMP)),TODATE);
    IF MONTHS > 12 THEN
    (YEARS := YEARS + INT(MONTHS/12);
    MONTHS := MONTHS MOD 12);
    DIFF := IIF(YEARS>0 ,TRIM(TOTEXT(YEARS,0)) & " YEARS " ,"0 YEARS ") &
    IIF(MONTHS>0,TRIM(TOTEXT(MONTHS,0))& " MONTHS ","0 MONTHS ")&
    IIF(DAYS>0 ,TRIM(TOTEXT(DAYS,0)) & " DAYS" ,"0 DAYS");

  • How to get two date difference in Day/hour/min/secs pl

    First of all,
    Hello to All, i am new to Oracle DB, but i have little experience in Other Database such as Sybase, sql server etc
    please kindly help me
    in DoctorChart table i have DocName,Id#,Citcotype,Medtype,AdmitDate,DischargeDate(both admitdate & Discharge date is date formatted columns)
    so how can i get the below differenceTime (which means Dischargedate-Admit Date in below format i.e, Day,Hours,Minutes,Seconds...)
    DoctorName, ID #, Citco type, MEDtype, DifferenceTime
    ========= === ======= ======= ===========
    Dr. KindaEmesko, 20045, Replace OutCard, ICH, 0 day 9 hours 11 minutes
    Dr. KindaEmesko, 20098, Replace OutCard, ICH, 1 day 2 hours 34 minutes
    Dr. KindaEmesko, 20678, Replace OutCard, ICH, 2 day 23 hours 52 minutes
    Dr. KindaEmesko, 20212, Replace OutCard, ICH, 4 day 1 hours 00 minutes
    Dr. KindaEmesko, 20345, Replace OutCard, BED, 3 days 14 hours 15 minutes
    Dr. KindaEmesko, 20678, Replace OutCard, BED, 9 days 21 hours 52 minutes
    Dr. KindaEmesko, 20015, Signature Overlay, Rest, 0 days 3 hours 29 minutes
    Dr. KindaEmesko, 45678, Signature Overlay, Rest, 0 days 1 hours 29 minutes
    Same way how can i get the Average Time for the above result (without ID columns)
    DoctorName, Citco type, MEDtype, Avg DifferenceTime
    ========= === ======= ======= ===========
    Dr. KindaEmesko, Replace OutCard, ICH, 2 day 1 hours 00 minutes
    Dr. KindaEmesko, Replace OutCard, BED, 6 days 17 hours 15 minutes
    Dr. KindaEmesko, Signature Overlay, Rest, 0 days 2 hours 29 minutes
    Please just tell me how to get the two dates difference as day/hour/minute format
    as well as how to get avg ( two dates difference as day/hour/minute format)
    Please Help me
    Thanks in advance

    Well, instead of all these suggested manipulations you can simply use intervals. Oracle uses day as a unit in date arithmetic, so Dischargedate-Admit Date is number od days between two dates. Built-in function numtodsinterval can be used to convert it into interval. For example:
    SQL> with t as (
      2             select trunc(sysdate) - 2 Admit_Date,
      3                    sysdate            Discharge_Date
      4               from dual
      5            )
      6  select  numtodsinterval(Discharge_Date - Admit_Date,'DAY') Hospital_Stay
      7    from  t
      8  /
    HOSPITAL_STAY
    +000000002 00:01:08.000000000
    SQL>  SY.

  • My ipod touch is in DFU mode 5g I need help, do not want to lose my data, please help in Spanish

    I need help, do not want to lose my data, PLEASE HELP IN SPANISH

    Una vez que el dispositivo está pidiendo ser restaurado con iTunes ... ya es demasiado tarde para salvar nada ... y usted debe continuar con la recuperación de ...
    Vea aquí> http://support.apple.com/kb/HT1808
    Es posible que tenga que probar más de una vez ... Asegúrese de seguir todos los pasos ...
    Tómese su tiempo ... Preste especial atención a los pasos 3 y 4.
    Para minimizar la pérdida ...
    Después de haber recuperado su dispositivo ...
    Re-sincronizar su contenido o restauración de la última copia de seguridad ...
    Restaurar desde copia de seguridad> http://support.apple.com/kb/ht1766
    Once the Device is asking to be Restored with iTunes... it is too late to save anything... and you must continue with the Recovery...
    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    To minimise loss...
    After you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766

  • Date Difference in OBIEE

    Hi
    I have two date columns and I want one logical column which contains difference of those two DATE columns.
    But I found that we dont have any Date difference or Date Add functions in OBIEE Answers.
    Can anyone tell me any work around for the Date ADD/DIFF functions?
    Thanks
    Radha

    Or if you want database specific date functions, use EVALUATE and then specify the database functions. Check my blog entry here http://oraclebizint.wordpress.com/2007/09/10/oracle-bi-ee-10133-support-for-native-database-functions-and-aggregates/
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Hard Drive Failure on HP DV 6000 Pavilion laptop Windows-XP​sp3 OS - Need Data Recovery Help

    Hard Drive Failure on HP DV 6000 Pavilion laptop - Need Data Recovery Help
    HP Pavilion DV 6108 NR, RG365UA, purchased in late 2006 at Best Buy, with Windows XP, upgraded to Service Pack 3. It has a Fujitsu hard disk, 60 gigabyte, partitioned into C: and a Recovery D:.
    Windows tries to boot up, but goes to blue screen with the message: "Unmountable Boot Volume" for one second, then just keeps recycling until I force a shutdown.
    BIOS Phoenix, hard drive test result: " #1-08 Fail "
    I ran a disk analysis/recovery program on the Cdrive and it seemed to show the directory structure intact, and it was able to recover some files. I was using the free one from Seagate (which only recovers small files). The second pass didn't run so well, and during the third run the program said I should not proceed further, and I should contact a professional disk recovery company.
    However, the D drive seems to be intact, so, I wonder if the disk is corrupted or just some aspect of the logical C drive is bad.
    How can I get the D: to run the recovery software on it? The recovery disks, made by Best Buy, only proceed to the R / F / Q option screen, and when I press R, I get a blue screen every time.
    Tapping the F10 key during startup gets me nowhere. Ditto the F11 key.
    I dont care about the hard disk; it is the data (files, docs, images, etc)  that I want.
    I contacted HP to order recovery disks but they are no longer available for my computer.
    Any suggestions would be greatly appreciated!
    Jon
    This question was solved.
    View Solution.

    Update...
    I found a website that offers the following:
    http://www.computersurgeons.com/p-13442-recovery-k​it-435422-001-for-hp-model-number-dv6108nr.aspx
    Recovery Kit 435422-001 For HP Model Number dv6108nr
    Price: $27.00
    Recovery Kit Set (An Entire Image of the Computer hard drive when the computer was new)
    But I wonder how useful it would be. Early XP , no doubt. And if my hard disk problem is a mechanical fault, would any recovery disk even work? The disks made by Best Buy when I bought mine new in 2006 don't do anything more than go to the R /F/ Q screen and then goes to a blue screen when I press R (to recover the OS and apps and data files). And, as I wrote, it is the data that I want, not the disk drive.

  • I was updating software and suddenly my IPHONE  started asking for I tunes on mobile screen ,  how can  i  get by screen back or How i can restore without loosing data , I m more worried about data , Please help in resolutio

    i was updating software and suddenly my IPHONE  started asking for I tunes on mobile screen ,  how can  i  get by screen back or How i can restore without loosing data , I m more worried about data , Please help in resolutio

    What exactly are you seeing on the phone's screen ? If the iTunes icon and cable then the phone is in recovery mode, in which case it's too late to take a new backup or to copy any content off the phone - you will have to connect the phone to your computer's iTunes and reset it back to factory defaults, after which you can restore to the last backup that you took or just resync your content to it

  • Date Difference between to date formula variable

    Hi Expert,
                    I have create two formula variable one for Document Date and another one for Goods reciept date
    and through formula variable I am subtracting these two formula variable and getting the no. of days between
    document date and GR date.
    This Shows me the correct value for one document date because i am filtering my query according to document
    date,
    while i am giving the date range for document date is shows me incorrect result. bucause document date formula
    variable contains only one date.
    Eg. i am giving the document date range like 01.02.2010 - 28.02.2010.
          In document date formula variable it contains only 01.02..2010 and GR date formula variable it contain correct
    value, thats why the date difference is incorrect because those PO which has PO date like 12.02.2010 for that Doc
    formula variable bring the same date like 01.02.2010.
    Please tell me the solution
    Thanks and Regards
    Lalit Kumar

    Hi Expert,
                     Actually i have created two formula variable on for PO date and another for GR date
    and i've restrict the query through PO date.
    while i am taking the single PO date in Selection parameter it showing me correct difference
    eg: Selection Parameter for PO: 01.01.2010
    But while i am taking the date interval for PO date
    eg: 01.01.2010-30.01.2010
    PO No: XXXXX123 , Doc date: 01.01.2010 GR date: 7.01.2010 then date difference is : 6
    PO No: XXXXX432, Doc date: 03.01.2010 GR date: 8.01.2010 then date difference is : 7 but it is 5
    Thanks and Regards
    Lalit Kumar

Maybe you are looking for

  • How to Hightlight the Data in Jsp Page

    How to Hightlight the Data in Jsp Page, I am doing doing search page,based on values given search page those are sent to servlet,in servlet based on some conditions if particuler id i am getting then i am redirecting to Respective jsp page with highl

  • ORA-06550 and PLS-00201 in PL/SQL Developer

    Hi all , I am facing the following error when i try to view the DDL of a table using pl/sql developer. ( right click on table and then DBMS_Metadata -> DDL) ORA-06550: line 7, column 5: PLS-00201: identifier 'SYS.DBMS_LOB' must be declared ORA-06550:

  • How to solve the JCO problem

    hi, everybody In my project, I must run some RFC to get my result. But when I build, deploy and run my project, error has happened as follows: " com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to resolve JCO destination name 'WD_F

  • Upgrade path  11.5.9 to R12.1.3..??

    Hi All, Our Current Environment. OS : RHEL 4 update 8 (32 bit) EBS Version : 11.5.9 Database :9.2.0.8 We are planning to upgrade EBS from 11.5.9 to R12.1.3. Is below path is corerect. *Upgrade database from 9.2.0.8 to  11.1.0.7 *lay down R12.1.1 file

  • Buying the Iphone 5 through Verizon in Europe?

    I am living in Rome, Italy and I was wondering if I could buy the Verizon Iphone 5 here because I am eligible for an upgrade and don't feel like paying full price. If it is possible where would I go to do this?