Calcular proximo dia habil

mail@pastecode.io avatar
unknown
apex
a month ago
475 B
3
Indexable
Never
Date currentDate = Date.today()+4;
Date nextBusinessDay = currentDate.addDays(1);

// Check if the next day is Saturday or Sunday
while (nextBusinessDay.toStartOfWeek() == nextBusinessDay || nextBusinessDay.toStartOfWeek().addDays(6) == nextBusinessDay) {
    nextBusinessDay = nextBusinessDay.addDays(1);
}

// Display the next business day in a debug log
System.debug('The current day day is: ' + currentDate);
System.debug('The next business day is: ' + nextBusinessDay);
Leave a Comment