Last active
January 28, 2018 14:20
-
-
Save prasannadeshpande/607d606d3c95d4dab0adafde2235b999 to your computer and use it in GitHub Desktop.
Adding Business days to DateTime using BusniessHours
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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