+ Start a Discussion

Previous working date based on the BusinessHours



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




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.





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