[#BloombergLP-bbldc-PeriodDayCountUtil-yearsDiff-0f]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bbldc.adoc[bbldc]::xref:BloombergLP/bbldc/PeriodDayCountUtil.adoc[PeriodDayCountUtil]::yearsDiff
:relfileprefix: ../../../
:mrdocs:

Return the (signed fractional) number of years between the specified `beginDate` and `endDate` according to the specified day&hyphen;count `convention` with periods starting on the specified `periodDate` values and each period having a duration of the specified `periodYearDiff` years (e&period;g&period;, 0&period;25 for quarterly periods)&period; If `beginDate &lt;&equals; endDate` then the result is non&hyphen;negative&period; The behavior is undefined unless `periodDate&period;size() &gt;&equals; 2`, the values contained in `periodDate` are unique and sorted from minimum to maximum, `min(beginDate, endDate) &gt;&equals; periodDate&period;front()`, `max(beginDate, endDate) &lt;&equals; periodDate&period;back()`, and `isSupported(convention)`&period; Note that reversing the order of `beginDate` and `endDate` negates the result&semi; specifically, `&verbar;yearsDiff(b,e,pd,pyd,c) &plus; yearsDiff(e,b,pd,pyd,c)&verbar; &lt;&equals; 1&period;0e&hyphen;15` for all dates `b` and `e`, periods `pd`, and year fraction per period `pyd`&period;

== Synopsis

Declared in `&lt;bbldc&lowbar;perioddaycountutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
double
yearsDiff(
    xref:BloombergLP/bdlt/Date.adoc[bdlt::Date] const& beginDate,
    xref:BloombergLP/bdlt/Date.adoc[bdlt::Date] const& endDate,
    xref:bsl/vector-00d.adoc[bsl::vector&lt;bdlt::Date&gt;] const& periodDate,
    double periodYearDiff,
    xref:BloombergLP/bbldc/DayCountConvention/Enum.adoc[DayCountConvention::Enum] convention);
----


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