Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Jane Marchand 2

# Calculate Contract End Date using Term in Months

HI
I'm trying to calculate the End Date of a Contract.
I have the Start Date and a Contract Term in Months
I need to make sure I cater for Leap Years
I also need to make sure that the End date DAY is the Start Date DAY decremented by 1.
E.G
• Start Date 15-03-01
• Term Months: 12
• End Date: 15-02-28 unless it's a leap year, therefore 15-02-29
Does anyone have a formula they'd be willing to share?
Thanks

sandeep sankhla
Hi Jane,

Please refer the below link and let me know if it helps..else I will guide you how to do..

Thanks,
Sandeep
Jane Marchand 2

Thanks Sandeep,
I tried working through that formula yesterday.
I just could not figure out how to decrement the end date by 1 day
The formula provided in the link above calculates the end date as exactly the same day as the start date but I need it to be start date (day) - 1.

Thanks

Jane

sandeep sankhla
Hi ,

In that case have you tried using -1..

I mean after all calculation we have date then that date.adddays(-1);

CHeck with this...do addDays(-1)..and let me know if it helps..

Thanks,
Sandeep
Ohtomo
I tried. but it's too large to use fomula field. You need to use workflow.
And I can not for some reason post the fomula.
so I post image capture.
Please excuse me if you may not understand or you feel bad with my poor English.

Jane Marchand 2
Thanks all  -  we ended up using a trigger to solve this