Question
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2024-04/7d305244-ea70-4f14-9686-adba1d1ce8ec.jpg?h=5273c2be&itok=layE3DM3)
Bits in Glass
IN
Posted: Feb 2, 2024
Last activity: Feb 6, 2024
Last activity: 6 Feb 2024 4:34 EST
Solved
Difference Between the Two Dates
As a pega developer, I want to create a function that calculates the difference between two dates in years, months, and days so that I can display the result in the user interface.
Acceptance criteria:
- The function takes two parameters: the start date and the end date, which are valid date values.
- The function returns a string that shows the difference between the two dates in the format of “X years, Y months, Z days.”.
- The function handles edge cases such as leap years, invalid dates, or negative differences.
- The function is tested with various input values and expected outputs.
***Edited by Moderator Rupashree to add Capability tags***