You need to sign in to do that
Don't have an account?
Shane Quiring
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.
best friendship quotes (https://lovequotes.co.in/friendship-quotes/)
IF(DAY(EndDate) < DAY(StartDate), (MONTH(EndDate)) + (12*(YEAR(EndDate)-(YEAR(StartDate)))) - (MONTH(StartDate)) - 1, (MONTH(EndDate)) + (12*(YEAR(EndDate)-YEAR(StartDate))) - MONTH(StartDate))
Try this to get the full months.
Logic: M(Date) + (12 * (Y(Date) - Y(Today)) - M(Today) + IF((EOMD(Today) - D(Today) + D(Date) - EOMD(Date) )/EOMD(Today)) > 0 , -1, 0)
SF Formula:
FLOOR(MONTH( Date__c ) + (12*(YEAR( Date__c )-YEAR(TODAY()))) - MONTH(TODAY()))
+
IF(((DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1) - DAY(TODAY())
+ DAY(Date__c ) - DAY(DATE(YEAR(Date__c ),MONTH(Date__c )+1,1)-1))/DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1)) < 0, -1, 0)
Thanks
Thanks to all for answering the question.
Read more about admin skillset. (https://www.cloudycoders.com/blog/salesforce-integration-by-cloudy-coders/)