Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

YearsBetween – XpressDox

«YearsBetween(EndDate,StartDate)» returns the approximate number of years between the two dates. The reason that it is approximate is that it is calculated as the number of days between the two dates divided by 365.25. Thus for a long time period, the result will be more accurate than for a short time period.

For example:

I was born on «FormatDate(DateOfBirth,‘d MMMM yyyy’)» which means I am «Round(YearsBetween(Today(),DateOfBirth) - 0.5)» years old.

The Round applied to the number of years less 0.5 effectively rounds the value down to the nearest smaller integer, which is usually how we quote a person’s age.

The insurance industry sometimes likes to use “age next birthday” which would be calculated as:

I was born on «FormatDate(DateOfBirth,‘d MMMM yyyy’)» which means that my age at next birthday will be «ceiling(RegionToX(YearsBetween(Today(),DateOfBirth)))» years.

See also The DaysBetween Function to see how to get the number of days between two dates.

Note that this feature is available only in Version 4 and later of XpressDox.