Skip to Content
author's profile photo Former Member
Former Member

can any one tell me difference between 2 dates in days

hi guys,

can any one tell me the difference between 2 dates in days

for eg: input 20.12.2006 and 06.11.2006 will be 34.

thanks in advance for you answers

Regards,

Anil kumar P

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:35 AM

    Hi Anil,

    Check this code for u r requirement

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 11, 2007 at 06:24 AM

    Hi,

    data : v1 type i.

    v1 = d1 - d2.

    write v1.

    If d1 and d2 hold date values of type sy-datum.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:34 AM

    Hi

    U try this FM

    SD_DATETIME_DIFFERENCE

    u set the time as 12 both tme fields

    hope this will help u

    Thanks

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:25 AM

    if two variables are of type d you can do by simple subtraction.

    d3 = d2 - d1.

    d3 also type i.

    other ways you have to use fm like DAYS_BETWEEN_TWO_DATES

    regards

    shiba dutta

    Message was edited by:

    SHIBA DUTTA

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:52 AM

    Hi,

    Use the FM:

    <b>SD_DATETIME_DIFFERENCE</b>

    Give the difference in Days and Time for 2 dates

    Hope this helps.

    Reward if helpful.

    Regards,

    Sipra

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.