[#BloombergLP-bdlt-CalendarUtil-subtractBusinessDaysIfValid]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/CalendarUtil.adoc[CalendarUtil]::subtractBusinessDaysIfValid
:relfileprefix: ../../../
:mrdocs:

Subtract business days from `original` if valid&period;

== Synopsis

Declared in `&lt;bdlt&lowbar;calendarutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
subtractBusinessDaysIfValid(
    xref:BloombergLP/bdlt/Date.adoc[bdlt::Date]* result,
    xref:BloombergLP/bdlt/Date.adoc[bdlt::Date] const& original,
    xref:BloombergLP/bdlt/Calendar.adoc[bdlt::Calendar] const& calendar,
    int numBusinessDays);
----

== Description

Load, into the specified `result`, the date that is the specified `numBusinessDays` chronologically before the specified `original` date according to the specified `calendar`&period; The resulting date is chronologically before the `original` date for positive values of `numBusinessDays`, the chronologically latest business day that is on or before the `original` date for `0 &equals;&equals; numBusinessDays`, and chronologically after the `original` date for negative values of `numBusinessDays`&period; Return 0 on success, and a non&hyphen;zero value, without modifying `&ast;result`, if either the `original` date or the resulting date is not within the valid range of `calendar`&period; Note that if `0 !&equals; numBusinessDays`, then the result of `subtractBusinessDaysIfValid(res, orig, cal, numBusinessDays)` is identical to the result of `addBusinessDaysIfValid(res, orig, cal, &hyphen;numBusinessDays)`&period;

== Return Value

0 on success, non&hyphen;zero on failure

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| destination for the resulting date
| *original*
| starting date
| *calendar*
| calendar used for business&hyphen;day determination
| *numBusinessDays*
| business days to subtract (may be negative)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
