I need to write a function -Add 2 years from any present given month for example - 2022-05-17 (yyyy-MM-day) and answer should be-2024-05-17
You can this below function
FormatDateTime(addCalendar(getCurrentDateStamp(),‘2’,“”,“”,“”,“”,“”,“”),“yyyy-MM-dd”,“”,“”)
Note: addCalendar function is the actual function to add the year and FormatDateTime is used to convert date into required date format.
Regards
Mamatha
To add 2 years to a given date in Pega, use the @addToDate() function.
@(Pega function) : AddToDate(“2022-05-17”, 2, “years”)
Where “2” indicates the number of years to add.
Thanks.
