Formula to calculate n months from date and give actual date - Salesforce

Formula to calculate n months from date and give actual date - Salesforce

There can be a general scenario in which we want to just calculate lets say 3 months or 4 months from current date or specific date. This is not that simple as we need to check for leap years as well as for varying months(some end with 30, some with 31).

I have created a formula that accomplishes it and give us the exact date after n months from a specific date.

FORMULA:

It simply checks for difference of days in months and then add that much value to current date. For example: if we have 1 Jan as date
custom date field : 1/01/2014
it will check in difference between jan and april as per 3 months. it will be something around 90 days as feb has 28 days. Then adding those days directly will give expected output.
So above will give 1/04/2014

Hope this helps!!

Lakshay Katney Avatar

Lakshay Katney

Saleforce developer by profession but I like to work with various technologies.I blog about Force.com, Hybrid Apps, PhoneGap, AngularJS, BackboneJS, JavaScript in general. I am Angular & NodeJS fan.

Read More
Share this page
Top 15 Posts