Add day,month,year to date example

Hi, you have a date and you want to add or subtract days, add months, years and subtract it. You may encounter a situation like this, for example, the date you have given may be February 29 days, the following function takes care of this process by itself. When you add 1 day on February 28, February 29 will come, not March 1.

* Subtract 1 day
    gs_popup-tarih = cl_reca_date=>add_to_date( EXPORTING id_days = -1
                                                            id_date = gs_popup-tarih ).

* Add 1 Day
      gs_popup-tarih = cl_reca_date=>add_to_date( EXPORTING id_days = 1
                                                            id_date = gs_popup-tarih ).

* Add 1 month
      gs_popup-tarih = cl_reca_date=>add_to_date( EXPORTING id_months = 1
                                                      id_date = gs_popup-tarih ). 

For example, February takes 29 days in 2020, as a result, I added 1 day to February 28.

Here, I take out 1 day from March 1,

Leave a Reply

Your email address will not be published. Required fields are marked *