Hi, when you want to calculate how many days are there between two dates, how many months are there, and to find how many years differs, you can do this with the code below,
* Gün sayısı DATA(lv_days) = cl_reca_date=>get_days_between_two_dates( EXPORTING id_datefrom = '20190101' id_dateto = '20190201' ). WRITE: / lv_days. * Ay sayısı DATA(lv_months) = cl_reca_date=>months_between_two_dates( EXPORTING id_date_from = '20190101' id_date_to = '20190201' ). WRITE: / lv_months. * Hepsi bi arada DATA: lv_years TYPE i. DATA: lv_months TYPE i. DATA: lv_days TYPE i. cl_reca_date=>get_date_diff( EXPORTING id_date_from = '20190101' id_date_to = '20190201' IMPORTING ed_years = lv_years ed_months = lv_months ed_calendar_days = lv_days ). WRITE: / lv_years. WRITE: / lv_months. WRITE: / lv_days.
Let’s illustrate, see how many days and months between February 2, 2020 and January 1, 2019.
Our code is as follows
Result: