Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

date Function

Former Member
0 Likes
943

Dear experts,

I need two date functions one for difference of date A and Date B which should return DATE

and another difference of date A and Date B which should return DAY

Can anyone pls give solution for this

Regards

karhitk

9 REPLIES 9
Read only

Former Member
0 Likes
894

Refer for difference between dates

Read only

Former Member
0 Likes
894

Hi,

Use SD_DATETIME_DIFFERENCE

and..

DAYS_BETWEEN_TWO_DATES

<b>Reward points</b>

Regarsd

Read only

Former Member
0 Likes
894

hi,

FM DATE_TO_DAY

Read only

Former Member
0 Likes
894

HI,

u can write

data:days type i.

parameters:date2 type sy-datum,

date1 type sy-datum.

days = date2 - date1.

write:/ days.

rgds,

bharat.

Read only

Former Member
0 Likes
894

For day

Read only

Former Member
0 Likes
894

hi

try FM

SD_DATETIME_DIFFERENCE

regards

ravish

reward if useful

Read only

Former Member
0 Likes
894

date3 = date1 - date2. tghis will give u the days.

or else

call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

exporting

i_date_from = p_lv_start_date

  • I_KEY_DAY_FROM =

i_date_to = p_lv_date1

  • I_KEY_DAY_TO =

  • I_FLG_SEPARATE = ' '

importing

<b>* E_DAYS = p_day</b>

e_months = p_lv_month_diff

  • E_YEARS =

.

Read only

Former Member
0 Likes
894

Hi,

Check out,

HR_HK_DIFF_BT_2_DATES

C14B_DIFF_BT_2_DATES

FIMA_DAYS_BETWEEN_TWO_DATES

FIMA_DAYS_BETWEEN_TWO_DATES_2

FIMA_LEAP_DAYS_BETWEEN_2_DATES

I think this would help,

<b>

Pls reward points if this helps,</b>

Kiran

Read only

Former Member
0 Likes
894

Hi Karthik,

use FM :

DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.

DATE_GET_WEEK will return the week that a date is in.

DATE_IN_FUTURE Calculate a date N days in the future.

DAY_ATTRIBUTES_GET Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday.


Find the difference between two days in days, months and years 
*
* Type in two date and find the difference between the two dates in
* days, months and years.
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*              http://www.sap-img.com
*
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.

Reward pts if found usefull : )

Regards

Sathish