You need to sign in to do that
Don't have an account?
Calculate the number of month left between two dates
Hi Experts,
I need some assitance with a date formula. I trying to calculate the number of months left between two dates, start and end date. I currently have the folloiwng formula:
(Custom_End_Date__c - today ())/30
Which will give me the number of days left and if I divide the number by 30 and I should get the numbner of months. Unfortunately I am short by one month. For example if I have a end date of 12/01/2015 minus today, 30 July, would give me 124 days. If I divide that by 30 I get 4 months, or more exactly 4.13 months. But from July to Dec is 5 months.
Any assistance would be greatly appreciated.
Thank-you
I need some assitance with a date formula. I trying to calculate the number of months left between two dates, start and end date. I currently have the folloiwng formula:
(Custom_End_Date__c - today ())/30
Which will give me the number of days left and if I divide the number by 30 and I should get the numbner of months. Unfortunately I am short by one month. For example if I have a end date of 12/01/2015 minus today, 30 July, would give me 124 days. If I divide that by 30 I get 4 months, or more exactly 4.13 months. But from July to Dec is 5 months.
Any assistance would be greatly appreciated.
Thank-you
If you are only concerned about difference in the actual month - ie July 30th to Aug 1st = 1 month
Try this:
(MONTH(Custom_End_Date__c) + (12*(YEAR(Custom_End_Date__c)-YEAR(TODAY()))) - MONTH(TODAY())
All Answers
Here's any example of the syntax:
Date a = Date.newInstance(2013,10,7);
Date b = Date.newInstance(2014,1,12);
Integer monthDiff = a.monthsBetween(b);
if (b.day() > a.day()) monthDiff++;
Thx
ABS(Month(End_Date__c) - Month(Start_Date__c))
Thanks,
Kaustav
If you are only concerned about difference in the actual month - ie July 30th to Aug 1st = 1 month
Try this:
(MONTH(Custom_End_Date__c) + (12*(YEAR(Custom_End_Date__c)-YEAR(TODAY()))) - MONTH(TODAY())
That worked perfectly.
I apreciate the help.
When I try to use Cyber's function I get this error:
"Syntax error. Missing ')'"
Can you please help me to fix it?
Thanks in advance
(MONTH(Custom_End_Date__c) + (12*(YEAR(Custom_End_Date__c)-YEAR(TODAY()))) - MONTH(TODAY())
this is working for me
i also use this quote for my blog https://budgetorbit.com/
Hello Everyone, Thanks for sharing . We are currently working toată lumea va fi acum încântată să urmărească serialul turcesti online subtitrat în română.on seriale turcesti blog. Bate la usa mea subtitrat in romana (https://clicksud.mobi/bate-la-usa-mea-subtitrat-in-romana/)
var a = someDate;
var b = someOtherDate;
var c = Math.abs(a - b);
answer = c.getMonth();
Best Apk (https://homeofapk.com/)
I have been trying this but couldn't do it. Please help How to acheive it.