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
pp11222pp11222 

Previous working date based on the BusinessHours

Hi

 

I need to find out the previous working date based on the BusinessHours .

 

Example

 

Order Due Date : Sunday, March 10, 2013

 

I need to get its previous working date which would be Friday, March 08,2013.

 

Also I want to make sure that if Friday was an holiday then it should return me Thursday, March 07,2013.

 

I have already looked at the business hours class  (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_businesshours.htm)

 

I was able to get the next buisiness day but not the previous buiseness day.

 

This is very urgent, I will appreciate if some one can provide me sample code for this.

 

Thanks

 

 

MJ Kahn / OpFocusMJ Kahn / OpFocus
To get the previous business day, use the BusinessHours class to add a negative number to the date time.