function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sugirtha Manohar 1Sugirtha Manohar 1 

Business Days calculation for Date/Time field

Hi,

We are have an "incident opened date" custom field with data type Date/Time.
Can you please help me with creating a formula field to calculate the business days.
I have tried many business day calculations from various post, however, they do not seem to take the time factor into account.
We are not too particular about the business hours.

For ex., if an incident is opened on Friday at 3p.m. on Monday at 3p.m. we would like the age to be 1 and on Tuesday at 3 p.m. the age would be 2.

Any assistance you provide would be much appreciated.

Thank you!
Best Answer chosen by Sugirtha Manohar 1
Raj VakatiRaj Vakati
Refer this link  

You have same solutions 



https://help.salesforce.com/articleView?id=000004526&type=1

https://success.salesforce.com/answers?id=90630000000hWyVAAU
https://developer.salesforce.com/docs/atlas.en-us.usefulFormulaFields.meta/usefulFormulaFields/formula_examples_dates.htm

All Answers

Raj VakatiRaj Vakati
Refer this link  

You have same solutions 



https://help.salesforce.com/articleView?id=000004526&type=1

https://success.salesforce.com/answers?id=90630000000hWyVAAU
https://developer.salesforce.com/docs/atlas.en-us.usefulFormulaFields.meta/usefulFormulaFields/formula_examples_dates.htm
This was selected as the best answer
Sugirtha Manohar 1Sugirtha Manohar 1
Hello Sir,

I am not sure if these formulae take the time factor into account. I will try them in the next couple of days and let you know how it goes.
Thank you for the taking the time and providing me this information.

Thank you!
Sugi
 
SathishPanjalaSathishPanjala
Hi Sugirtha Manohar 1, 

There are few complications/mis understandings behind the formula field to calculate the business hours, Since you're not concerned about the hours you can achieve this functionality with a Batch job which you can run on end of every day.

1) Add a record in Busines Hours : [ Setup >> Company Profile >> Business Hours ]
2) Query that record in Apex class based on those 2 dates and find out the differance.
with that you can easily grab the business days.
3) Schedule this job every end of the day.

Sathish P
Sugirtha Manohar 1Sugirtha Manohar 1
Thank you for your response Sir. Sorry, I couldn't respond earlier. I was able to do this using a formula field.
Sugirtha Manohar 1Sugirtha Manohar 1
Thank you for your response Sir. Sorry, I couldn't respond earlier. I was able to use the formulae you provided and resolve our issue. Appreciate your help and sorry I misspoke earlier. Thank you! [cid:image003.jpg@01D3C763.B767A8B0] SUGIRTHA MANOHAR Business Systems Analyst, Enterprise Business Technology (o) 858.368.7596 | sugirtha.manohar@mitchell.com Connect with us LinkedIn | Twitter | YouTube | mitchell.com Stay connected with [cid:image004.jpg@01D3C763.B767A8B0] Your source for technology and business trends impacting the industry.