40.number of Days in February
40.number of Days in February
a given year using a Data Transform. This use case will involve creating a Data
Transform that uses the provided function to set the number of days in
February.
2. Create a property to hold the number of days in February. For example, DaysInFebruary.
2. Add a step to check if the year is a leap year. You can use the following logic:
o If Year % 4 == 0 and (Year % 100 != 0 or Year % 400 == 0), then set DaysInFebruary to 29.
1. Set .DaysInFebruary = 28
2. When .Year % 4 == 0
- Set .DaysInFebruary = 29
- Otherwise
- Set .DaysInFebruary = 29
o For example, input 2020 (leap year) and check if DaysInFebruary is set to 29.
Function Breakdown:
Param.Year % 4 == 0: This checks if the year is divisible by 4.
Param.Year % 100 == 0: This checks if the year is divisible by 100.
Combined Logic:
(Param.Year % 4 == 0 && !(Param.Year % 100 == 0 && Param.Year % 400 != 0))
First, it checks if the year is divisible by 4.
Then, it checks if the year is divisible by 100 and not divisible by 400.
If the year is divisible by 4 and either not divisible by 100 or divisible by 400, it returns 29
(indicating a leap year with 29 days in February).