[#BloombergLP-bdlt-DateUtil-addYears]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/DateUtil.adoc[DateUtil]::addYears
:relfileprefix: ../../../
:mrdocs:

Return `original` advanced by `numYears`, optionally preserving EOM&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdlt/Date.adoc[Date]
addYears(
    xref:BloombergLP/bdlt/Date.adoc[Date] const& original,
    int numYears,
    bool eomFlag);
----

== Description

Return the date that is the specified `numYears` from the specified `original` date, adjusted as necessary according to the specified `eomFlag` (end&hyphen;of&hyphen;month flag)&period; If `eomFlag` is `true` and `original` is the last day of the month, then adjust the result to be the last day of the month&semi; if `eomFlag` is `false`, then no such adjustment is performed&period; In any case, if the day of the month in `original` does not exist in the month of the result (e&period;g&period;, February 29, 2001), move the resulting date to the last day of the month&period; The behavior is undefined unless the operation results in a valid `Date` value&period; Note that `numYears` may be negative&period;

== Return Value

resulting date

== Parameters

[cols="1,4"]
|===
| Name| Description
| *original*
| starting date
| *numYears*
| years to add (may be negative)
| *eomFlag*
| whether to preserve end&hyphen;of&hyphen;month when applicable
|===


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