DateInterval.Years

From Xojo Documentation

Property (As Integer )
aDateInterval.Years = newIntegerValue
or
IntegerValue = aDateInterval.Years

Supported for all project types and targets.

The number of years in the interval.

Sample Code

Var d1 As New Date(2017, 5, 1, TimeZone.Current)
Var d2 As New Date(2030, 1, 1, TimeZone.Current)
Var interval As DateInterval
interval = d2 - d1
// interval.Years = 12