Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding Business days to DateTime using BusniessHours
public static Datetime addBusinessDays(Datetime startDate, Integer numberOfDays, id busniesshourId)
{
Integer count = 0;
while (count < days) {
startDate = startDate.addDays(1);
if (BusinessHours.isWithin(businesshourId, startDate))
count++;
}
return startDate;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment