SAP Knowledge Base Article - Public

3527621 - Business Rule - How To Fetch the Last Date of the Month (Leap Year)

Symptom

The requirement is to build a rule to fetch:

  • Last day of the current month 
  • First day of the next month

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

SAP SuccessFactors Employee Central

Resolution

1. Create a custom date field and provide all the permissions to view on the UI

2. Create a business rule (in this example creating the dates in the variable so that the can be reused within the rule configuration). For this particular example we're creating an always true rule.

Below is the result:

This formulation will always return the correct end date of the month including for Leap Year (29 February as can be noted in the image)

This date retrieval formulation can be used to in any kind of business rules including for accrual calculations and derivations.

NOTE: The rule was created + run on the 18 of February 2024:

  • The fist day of the month is 01/02/2024
  • the last day of the month is 29/02/2024 (the system has correctly derived the leap year)
  • the first day of the NEXT month is 01/03/2024

See Also

2669318 - Last day of month in business rule

Keywords

Last day of a month, Last day, Last day in business rule, Find last day of a month , KBA , LOD-SF-EC , Employee Central , LOD-SF-EC-TIM-RUL , TAT Rules, Validation & Take rules , How To

Product

SAP SuccessFactors Employee Central all versions

Attachments

Pasted image.png
Pasted image.png