The CL_RECA_DATE
class is available for quite a suite of date related operations. It can be used to calculate with dates, convert them to an internal format as a string, check the validity of a date, the list is not endless but over 30 methods are available to you.
Just a few short and sweet examples: to convert a date into a string:
CL_RECA_DATE=>CONVERT_DATE_TO_STRING( exporting ID_DATE = sy-datum importing ED_DATE_STRING = lv_string ).
lv_string
will contain 16.05.2014
.
Convert a start and enddate into a "range of" string:
data: lv_date type d, lv_string type string. lv_date = sy-datum + 5. CL_RECA_DATE=>CONVERT_RANGE_TO_STRING( exporting ID_DATEFROM = sy-datum ID_DATETO = lv_date importing ED_RANGE_STRING = lv_string ).
lv_string
will contain 16.05.2014-21.05.2014
. I don't see great use of this either. Bad examples of a potentially good class. Maybe ADD_MONTHS_TO_DATE
and CHECK_INTERSECTION
are more useful ? Check it out !
There is also a simple class available for useful date constants, such as "Infinity". Check out class CL_ISU_DATE
and implement anywhere in your coding. Like so:
IF p_mydate = CL_ISU_DATE=>CO_DATE_INFINITE. ... ENDIF