Difference in days

Hi all
I would like to calculate difference in days, a normal formula will be date1 - date2. Here my case is Date1 is calender day and date2 is system date (SY-DATUM)
So i need to calculate calender day - system date only during run time which obviously should happen through the query designer it self
can any one help me to resolve this
Thanks in advance

Hi,
You need 1. Replacement path Variable and
               2. Customer Exit.
1. Craete Replacement path variable (ZCALDAY) in Formula and Replace with Calender day, Replace with Key, so it will capture your 0CALDAY value in this Variable.
2. Customer Exit:
Craete ZCURDAY Customer Exit Variable on Formula only , Variable entry = Mandatory,
Processing = Custome Exit
UnCheck Ready for input.
Dimension Id  = Date.
Then write the following code in CMOD.
WHEN 'ZVCURDAY'.
      CLEAR: l_s_range.
      l_s_range-low = sy-datum.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'EQ'.
      APPEND l_s_range TO e_t_range.
Then create one formula and just do sustraction i.e. ZVCURDAY- ZCALDAY
Thanks
Reddy

Similar Messages

  • I want to know the difference between Days column and Day1 Column

    Hi All,
    I used this query:
    SELECT to_char(return_date_time,'dd/mon/yyyy hh24:mi:ss') Test,
    DECODE ('I', 'I', DECODE (1, NULL, NULL, 0, NULL, SYSDATE + 1)) Days,
    DECODE ('I', 'I', SYSDATE + 1) Day1
    FROM fm_curr_locn
    WHERE patient_id = 'DU00002765'
    output: 
    Test
    Days
    Day1
    26/oct/2013 00:00:00
    26-OCT-13
    10/26/2013 3:06:59 PM
    I want to know the difference between Days column and Day1 column and why the days column didnt show the time
    Please anyone help.....
    Regards
    Shagar M

    Pleiadian wrote:
    It is the decode statement that is doing this.
    The format of decode is:
    decode(expression, search1, result1, search2, result2, searchn, resultn, default)
    All result fields must be of the same datatype and will be of the datatype of the first result (result1 in this example)
    In your example (the decode for the field Days) the first result is a NULL. I suspect (gurus? anyone?) that Oracle will use the varchar2 overload of the decode statement, and the date field will be converted to varchar2 using your NLS_DATE_FORMAT settings.
    In the second decode statment (Day1) the first result is of datatype date, so the result of the decode statement will be a date field (and will be parsed as such by your sql development tool)
    I agree, as NULL is the first result returned the datatype is undetermined, so Oracle is picking VARCHAR2 over others, and causing an implicit datatype conversion on the resultant date value, whereas the other which is returned as a date will use the local settings of the client tool being used.
    I can replicate the 'issue' in Toad, and it's rectified if we cast the first returned value of the decode statement...
    SELECT DECODE ('I', 'I', DECODE (1, NULL, CAST(NULL AS DATE), 0, NULL, SYSDATE + 1)) Days,
           DECODE ('I', 'I', SYSDATE + 1) Day1
    FROM dual

  • Calculate Difference in Days Between two Dates

    Hi,
    I'm trying to figure out how to calculate the difference in days between two dates using JavaScript in LiveCycle. (JavaScript knowledge = minimal)
    Where "Start_Date" and "Current_Date" are the names of the two dates in the Hierarchy palette. (both Date/Time Field)
    *Current date is using the Object > Value > Runtime Property > Current Date/Time
    I need a Text or Numeric field displaying the difference in days. (Difference_in_Days)
    I've noticed the following code being pretty standard amongst other responses:
    var 
    Start_Date = new Date(Start_Date);
    var 
    Current_Date = new Date(Current_Date);
    var 
    nAgeMilliseconds = Current_Date.getTime() - Start_Date.getTime();
    var 
    nMilliSecondsPerYear = 365 * 24 * 60 * 60 * 1000;
    I know there's code missing, and the above code might not be correct.
    Please advise.

    Where "DateField01" = user entered date field
    Where "DateFiled02" = Current Date/Time (Runtime Property)
    where "Subform" = the subform containing DateField01
    My script now resembles:
    var oneDay = 24*60*60*1000;
    var firstDate = new Date(Subform.DateField01.rawValue);
    var secondDate = new Date(DateField02.rawValue);  
    (firstDate.getTime() - secondDate.getTime()) / oneDay;
    I tried adding:
    app.alert(String(diffDays));
    Although I assume the reason I didn't get an error is because DateField01 is empty when the form is opened.
    If I swap in actual dates instead of fields it works perfectly.
    When I use the fields I have no information populating after I enter a date in "DateField01"

  • Date difference in Days,hours minutes and seconds.

    Hi All,
    I have two date Suppose one is getdate() and other one is gatedate() +1 .I have to show the difference, currently I used a datediff in the stored proc which just shows the difference of the days :( but i need to show the difference in days:hours:minutes:seconds if possible.
    its a countdown with the current date. Like the two fields are sale_start_date and sale_end_date. Hope i am clear.
    Please let me know ASAP thanks in advance.Can anyone help me?all help is great help.
    Say the difference of
    12/6/2007 7:00:00 AM, 12/8/2007 8:00:00 AM  as 2 days 1:00:00)
    Thanks
    N

    One of the problems of using DATEDIFF when dealing with either seconds or milliseconds is that this function will result in execution errors if the start and end dates span then entire domain of possible dates.  Below is an alternative that seems to work over the entire date domain.  A couple of things to note:
    1. This select converts the days and seconds of each date into BIGINT datatypes to avoid the overflow error
    2. This select uses a CROSS APPLY operator; in this case I chose CROSS APPLY to suggest the possibility of converting this select into an inline table function.
    I suspect that if you dig around this forum and the net that you will find a better routine, but here is yet another alternative:
    declare @test table
    ( startDate datetime, endDate datetime)
    insert into @test values
    ('6/1/9', getdate()),
    ('6/9/9 15:15', '6/10/9 19:25:27.122'),
    ('6/9/9 15:15', '6/10/9 13:25:27.122'),
    ('6/9/9', '6/10/9 00:00:01'),
    ('1/1/1760', '12/31/2999')
    select
      startDate,
      endDate,
      [Days],
      [Hours],
      [Minutes],
      [Seconds]
    from @test
    cross apply
    ( select
        cast((endSecond - startSecond) / 86400 as integer) as [Days],
        cast(((endSecond - startSecond) % 86400) / 3600 as tinyint) as [Hours],
        cast(((endSecond - startSecond) % 3600) / 60 as tinyint) as [Minutes],
        cast((endSecond - startSecond) % 60 as tinyint) as [Seconds]
      from
      ( select
          86400 * cast(convert(integer, convert(binary(4),
                        left(convert(binary(8), startDate),4))) as bigint)
            + cast(convert(integer, convert(binary(4),
                right(convert(binary(8), startDate),4)))/300 as bigint)
          as startSecond,
          86400 * cast(convert(integer, convert(binary(4),
                        left(convert(binary(8), endDate),4))) as bigint)
            + cast(convert(integer, convert(binary(4),
                right(convert(binary(8), endDate),4)))/300 as bigint)
          as endSecond
      ) q
    ) p
    /* -------- Sample Output: --------
    startDate               endDate                 Days        Hours Minutes Seconds
    2009-06-01 00:00:00.000 2009-06-22 08:28:36.670 21          8     28      36
    2009-06-09 15:15:00.000 2009-06-10 19:25:27.123 1           4     10      27
    2009-06-09 15:15:00.000 2009-06-10 13:25:27.123 0           22    10      27
    2009-06-09 00:00:00.000 2009-06-10 00:00:01.000 1           0     0       1
    1760-01-01 00:00:00.000 2999-12-31 00:00:00.000 452900      0     0       0
    (5 row(s) affected)
     EDIT:
    I based the routine more-or-less on Thilla's reply.
    Kent Waldrop

  • How to get difference in days between 2 dates excluding weekends

    Hi all,
    i have a requirement, to calculate the difference between 2 dates, in days.
    eg: 01/08/2007 and 05/08/2007.
         Difference = 4 days.
    But here my actual requirement is i have to calculate this difference excluding weekends (saturday n sundays).
    eg: 01/08/2007 -
    Thursday
         05/08/2007 -
    Monday
    so now Difference = 2 days.
    Please help me regarding this.
    Points will be rewarded for helpfull answers.
    Thanks in Advance.
    Regards,
    Vineel

    see these codes of rich
    report zrich_0003.
    data: begin of itab occurs 0,
          datum type sy-datum,
          end of itab.
    data: weekday like dtresr-weekday.
    data: number_lines type i.
    parameters: p_sdatum type sy-datum,
                p_edatum type sy-datum.
    itab-datum = p_sdatum.
    append itab.
    do.
      if itab-datum = p_edatum.
        exit.
      endif.
      itab-datum = itab-datum + 1.
      call function 'DATE_TO_DAY'
           exporting
                date    = itab-datum
           importing
                weekday = weekday.
      if weekday = 'Sat.'
        or weekday = 'Sunday'.
        continue.
      endif.
      append itab.
    enddo.
    describe table itab lines number_lines.
    write:/ 'Number of days between dates is', number_lines.
    and
    report zrich_0001.
    parameters: p_start type sy-datum,
                p_end   type sy-datum.
    data: idays type table of   rke_dat with header line.
    data: workingdays type i.
    call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
         exporting
              i_datab               = p_start
              i_datbi               = p_end
              i_factid              = 'P8'  " Fact Calender ID
         tables
              eth_dats              = idays
         exceptions
              date_conversion_error = 1
              others                = 2.
    describe table idays lines workingdays.
    write:/ workingdays.
    I want to find the No.of working days between the two dates
    regards,
    srinivas

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

  • Hi, i want  to find the difference in days of two students Date Of Birth

    hi, i want to find the difference in days of two students Date Of Births
    how can i find.
    please help me

    i didn't find what u saidLet me help you:
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=difference+between+dates&subCat=siteforumid%3Ajava54&site=dev&dftab=siteforumid%3Ajava54&chooseCat=javaall&col=developer-forums

  • Subracting dates at report level , to get difference in days.

    Hi team,
    I have 2 Key figure End date & start date & I need to present a difference between these dates in form of days .
    Firstly it is possible at report level , by using process value as date [DATE] on both the end & start date fields , later subtract start date from end date.
    I am nt sure whether out put wil b accurate .
    Is there any functional module already existing tht cn , give the difference between dates in no of days?

    Hi all,
    about this procedure, my questions are:
    1) can this procedure be applied if start and end date are attributes of a given infoobject?
    2) if "yes" on point "1)", how can you avoid aggregation? In this case, summarization is not meaninful. Example: a given project have a "start date" and an "end date", so the difference between these dates is project duration. In a cube multiple records refers to the same project hence these dates should not be summarized
    3) does these procedure work on a multiprovider?
    My questions arises because I'm trying to compute with dates on a multiprovider, dates are attributes and unfortunately it seems not to work.
    Any help?
    Thx!
    LJ

  • Standard function for returninf time difference in days and hours.

    Hello all,
                Can somebody tell me whether there exists some standard function module which can calculate the time difference and returns the calculated time in the form of days and hours ?
    e.g. the time difference between the date 1.12.2007 from 7.00 pm to the date 1.1.2008 till 9.00 pm is
    30 days  and 2 hours or 30 : 2.
    answer as soon as possible.
    Thanks and regards,
    me

    Thanks a lot ya..
    thats an absolutely correct solution to my problem.  )

  • Calculate difference of days between two dates

    Hi,
    Date1: It is a mandatory type-in date at the time of query execution. How to create it? By default, it should take today's calendar date.
    Date2: it is a date in a Char format. (0NETDUEDATE) in one of the dimension of InfoCube.
    In query column
    of days = Date1 - Date2.
    I would prefer to use in global variable.
    Please help.
    ~S

    Hello ,
               For date 1 create a characteristic variable(ready to input) on 0calday with customer exit as processing type and key in the following code to get the system date.
    data aktdat  like sy-datum.
    when 'test'.
        aktdat = sy-datum(6).
        clear l_s_range.
        l_s_range-low   =  aktdat.
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        append l_s_range to e_t_range.
    Then create a user entry variable for date 2 using the characteristic mentioned,
    then for calculating the days difference check the following.
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html

  • PLD - How to calculate difference in days

    Hi,
    I have a print layout with two different dates (posting date and current date). I need to show the difference between these dates in days. Apparently a formula field with one field minus the other field doesn't do it .
    How can I get the number of days between two dates ?
    Any help is appreciated.
    Regards,
    Johan

    Hi Johan..
    Have you checked with the following thread..
    http://scn.sap.com/thread/1074105
    Hope Helpful
    Regards
    Kennedy

  • 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

  • Find the same day in a range then find the difference between the days

    Need assistnace with the following .
    I have a table of ids for courses and each course class is on a day. I have to take the first day the course class is on and find the next same day then work out the difference in days.
    eg. a course class is on a saturday then have to go thru the course class associated to a course and find the next saturday then work out the difference.
    Anyone able to help - it would be much appreciated

    course class id date day
    abcdefa 18/12/2002 wednesday
    abcdefb 19/12/2002 thursday
    abcdefc 20/12/2002 friday
    zxvyza 17/12/2002 monday
    zxvyzb 20/12/2002 thursday
    zxvyzc 21/12/2002 friday
    zxvyzd 24/12/2002 monday
    zxvyze 26/12/2002 wednesday
    lmnopa 11/11/2002 tuesday
    lmnopb 12/11/2002 wednesday
    lmnopc 14/11/2002 friday
    lmnopd 19/11/2002 wednesday
    lmnope 21/11/2002 friday
    where abcdefa, abcdefbc, abcdefc are for course id abcdef
    and the other set of course class ids are for course id zxvyz.
    and 3rd set relates to course id lmnop.
    expectation:
    the difference between days for the first set of data to be 0
    the difference between days for 2nd set to be 7 days (ie. take the first day for the course class and see if can find another that is the same and then work out the difference i.e monday) then return the difference then go to next course class id.
    the diff between 3rd set is calc the diff between Wednesdays, ignore the last friday and find the next course class id. the answer here will be 7 days.
    I have worked out the days from the dates (although the above is only an example)but wasnt sure how to pick the same days then work out the difference and then move to the next course class id. Some course classes wont have another same day.

  • Job to retrieve difference in seconds (sometimes days)

    Hi, good day everyone.
    I managed (with your help btw) to get the difference (in seconds for each time an UTR 'NAME' fails and return) with a job which runs every time at morning for the last day (sysdate -1), the problem is that I need to retrieve the data when the time is null (when the UTR didn't return that day), here's an example:
    CREATE TABLE     evtmsg
    (       evt_date             DATE,
         message          VARCHAR2 (50)
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('04/10/2010 8:39:05', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 fail');*
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('04/10/2010 8:39:05', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MAD-1 fail');*
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('04/10/2010 8:39:08', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 return');*
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('04/10/2010 8:39:50', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02ZPD-1 fail');*
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('04/10/2010 8:39:50', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MAD-1 return');*
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('05/10/2010 5:40:22', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 fail');
    INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('05/10/2010 8:38:50', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02ZPD-1 return');In this case, if today was 5th (after running the job in the morning (01:00:00 a.m)), I'd have the next outcome:
    Select * from qtyuna;
    04/10/2010 8:39:05     04/10/2010 8:39:08   UTR 02MCD-1    3
    04/10/2010 8:39:05     04/10/2010 8:39:50   UTR 02MAD-1    45
    04/10/2010 8:39:50     null                           UTR 02ZPD-1    nullAnd if I do the same query on 6th (after the job) I'd like to get this:
    Select * from qtyuna;
    04/10/2010 8:39:05     04/10/2010 8:39:08   UTR 02MCD-1    3
    04/10/2010 8:39:05     04/10/2010 8:39:50   UTR 02MAD-1    45
    04/10/2010 8:39:50     05/10/2010 8:39:55   UTR 02ZPD-1     86405
    05/10/2010 5:40:22     null                           UTR 02MCD-1    nullThe job I have is this
    INSERT INTO qtyuna (datefa, datere, rtunam, timefa)
                    SELECT evt_date_fallo, evt_date_retorno, id, TO_CHAR(TO_CHAR(evt_date_retorno, 'SSSSS') - TO_CHAR(evt_date_fallo, 'SSSSS'))seconds,
                    FROM    (SELECT evt_date evt_date_fallo,
                    LEAD(evt_date) OVER (partition by id ORDER BY id||TO_CHAR(evt_date, 'yyyymmddhh24miss')||CASE status WHEN 'return' THEN 1 ELSE 2 END) evt_date_retorno,
                    id,
                    status
                      FROM  (SELECT evt_date,
                          SUBSTR(message, 1, 11) id,
                          SUBSTR(message, 13) status
                          FROM   [email protected]
                          WHERE  message LIKE 'UTR%'
                          AND    categ = 1
                          AND    TRUNC(evt_date) = TRUNC(SYSDATE - 1)))
                      WHERE    status like '%fail%'
                      ORDER BY evt_date_fallo;I don't know if I need another job to do that... if so, could you tell me how?
    Regards

    Hi,
    It looks like the main problem is how you are computing the seconds column.
    In Oracle, if you subtract one date from another, you get the difference in units of 1 day. If you want the difference in seconds, multiply the difference in days by the number of seconds in one day. There's no need to use TO_CHAR, and nothing special has to be done if the DATEs are on different calendar days.
    In your case, once you have the two DATEs identified, the way to get the number of seconds between them is:
    (evt_date_retorno - evt_date_fallo) * 24 * 60 * 60because each day has 24 hours, each hour has 60 minutes, and each minute has 60 seconds.
    There are lots of other things you could change. In particular, the way you are using LEAD is very confusing. If you are using Oracle 10 or higher, then I suggest using FIRST_VALUE instead, like this:
    DEFINE     TEST_SYSDATE     = "(DATE '2010-10-05' + (1 / 24))"
    -- INSERT INTO qtyuna (datefa, datere, rtunam, timefa)     -- Removed for testing
    WITH    got_evt_date_retorno     AS
         SELECT  evt_date               AS evt_date_fallo
         ,     LAST_VALUE ( CASE
                                WHEN  SUBSTR (message, 13) = 'return'
                           THEN  evt_date
                        END
                          IGNORE NULLS
                      ) OVER ( PARTITION BY  SUBSTR (message, 1, 11)
                                   ORDER BY       evt_date          DESC
                          )             AS evt_date_retorno
         ,       SUBSTR (message, 1, 11)            AS id
         ,     SUBSTR (message, 13)            AS status
         FROM     evtmsg
         WHERE     SUBSTR (message, 1, 3)     = 'UTR'               -- More efficient than LIKE
    --     AND     categ                     = 1               -- There's no categ in the sample data
         AND     evt_date          < TRUNC (&test_sysdate)     -- Use SYSDATE in Production
    SELECT       evt_date_fallo
    ,       evt_date_retorno
    ,       id
    ,       (evt_date_retorno - evt_date_fallo) * 24 * 60 * 60     AS seconds
    FROM       got_evt_date_retorno
    WHERE       SUBSTR (status, -4)     = 'fail'               -- Do we need SUBSTR here?
    -- ORDER BY  evt_date_fallo                         -- For testing only
    ;You wrote this with a separate sub-query to get id and status from message. That's not a bad idea; you could add another sub-query above.
    I changed SYSDATE to a substritution variable for testing. After you're through with testing, change &test_stsdate to SYSDATE.

  • How can get difference between 2 dates in the form of days

    how can get difference between 2 dates in the form of days

    Hi,
    Check the following program:
    REPORT ZDATEDIFF.
    DATA: EDAYS   LIKE VTBBEWE-ATAGE,
          EMONTHS LIKE VTBBEWE-ATAGE,
          EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
                TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Regards,
    Bhaskar

Maybe you are looking for