Supported by
Supported by Inetum

Class with loads of methods to deal with dates

images/thumbnail.jpg - Thumbnail

There are countless standard functions to make calculations with dates. There are too many of them, they are redundant and, in many cases, they are obscure or impossible to understand. I’ve been meaning to insert an article here with a list of the most useful ones. But now it’s no longer necessary.

Sérgio Fraga has found a fantastic class with a set of static methods to do everything with dates and more besides.

The class is called CL_RECA_DATE.

Here’s a list of its methods. It’s long and they are all useful:

  • ADD_MONTHS_TO_DATE

  • ADD_TO_DATE

  • AS_CHAR

  • CALCULATE_BUSINESS_DATE

  • CHECK_DATE

  • CHECK_INTERSECTION

  • CHECK_PERIOD

  • CHECK_PERIODS_OF_TABLE

  • CONVERT_DATE_TO_INTERNAL

  • CONVERT_DATE_TO_STRING

  • CONVERT_DATE_TO_STRING_X

  • CONVERT_RANGE_TO_STRING

  • CREATE

  • CREATE_DATE_RANGES

  • CREATE_DATE_RANGES_COMPRESSED

  • CUT_DATE_RANGES

  • FILL_DATE_TABLE

  • GET_CALENDAR_UNITS

  • GET_CURRENT_DATE

  • GET_DATE_DIFF

  • GET_DATE_INFO

  • GET_DAYS_BETWEEN_TWO_DATES

  • GET_INTERSERCTING_PERIOD

  • GET_WEEKDAY

  • GET_WEEKDAY_SHORT

  • GET_WEEK_INFO_BY_DATE

  • IS_DATEFROM_INITIAL

  • IS_DATETO_INITIAL

  • IS_DATE_INITIAL

  • IS_DATE_OK

  • MERGE_TABLES

  • MONTHS_BETWEEN_TWO_DATES

  • SET_TO_BEGIN_OF_MONTH

  • SET_TO_END_OF_MONTH

  • SET_TO_NEXT_DAY

  • SPLIT_TABLE_IN_DATERANGE

  • SUB_MONTHS_FROM_DATE

  • END_OF_MONTH_DETERMINE

Thanks Sérgio Fraga!

Greetings from Abapinho.