Choose where you’d like to start

subBusinessDay()

Overview

The subBusinessDay() function takes dateTimeValue and numberOfBusinessDays as arguments. It returns the dateTimeValue after subtracting the specified number of business days to it.

Note: By default, Monday to Friday, irrespective of any day being a holiday, are considered as business days.

The date-time value will be returned in the format specified in Application Settings.

Return Type

  • Date-Time

Syntax

<variable> = <dateTimeValue>.subBusinessDay(<numberOfBusinessDays>, [<weekends>], [<holidays>]);

(OR)

<variable> = subBusinessDay(<dateTimeValue>, <numberOfBusinessDays>, [<weekends>], [<holidays>]);
ParameterData typeDescription
variableDATE-TIMEVariable which will contain the returned date-time value.
dateTimeValueDATE-TIME

The date-time value from which the specified number of business days will be subtracted.

The date-time value can be specified without a time value, in which case 00:00:00 will be taken as the default time value.

If the hour value is specified as 24 or more, the date-time value be reset to 00:00:00. If the minutes value is specified as 60 or more, the mm:ss value will be reset to 00:00, if the seconds value is specified as 60 or more, the ss value will be reset to 00.

A runtime error will be encountered if:

  • the hour value, or minute value, or second value, is specified in more than 2 digits.
  • the date value exceeds the number of days in that month.
  • an incorrect month value is specified.
  • the year value has more than 4 digits.

Refer this help document to learn about the supported date-time formats.

numberOfBusinessDaysNUMBER

The number of business days to be subtracted to dateTimeValue.

Note:

  • A negative number will return the given date-time value as it is.
  • To add businessDays to a date, use addBusinessDay built-in function.
  • The value of this parameter cannot be more than 365.
weekends
(optional)
COLLECTION
(OF TEXT)

The list of weekends that should be considered while subtracting business days.

Note

  • By default, the weekends list is {Saturday, Sunday}
holidays
(optional)
COLLECTION
(OF DATES)

The list of holidays that should be considered while subtracting business days.

Note

  • If no holidays are provided, any day (except weekends) will be considered a working day.

Examples

info '21-Jul-2021'.subBusinessDay(5,{"Sunday"},{'20-Jul-2021','19-Jul-2021'}); // Returns 13-Jul-2021 
 
info '21-Jul-2021'.subBusinessDay(5); // Returns 14-Jul-2021 considering Saturday and Sunday as Weekend 
 
info zoho.currentdate.subBusinessDay(5,{"Sunday"},{'20-Jul-2021','19-Jul-2021'}); // Considering current date as 21-Jul-2021, it returns 13-Jul-2021 
 
info zoho.currenttime.subBusinessDay(5,{"Sunday"},{'20-Jul-2021','19-Jul-2021'}); // Considering current date as 21-Jul-2021, it returns 13-Jul-2021

Related Links

Get Started Now

Execute