Skip to content

Instantly share code, notes, and snippets.

@prasannadeshpande
Last active January 28, 2018 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prasannadeshpande/607d606d3c95d4dab0adafde2235b999 to your computer and use it in GitHub Desktop.
Save prasannadeshpande/607d606d3c95d4dab0adafde2235b999 to your computer and use it in GitHub Desktop.
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