Functions (all)
YearSpan
- Function Name:
- YearSpan
- Description:
-
It is sometimes useful to be able to categorise dates by periods that they fall into. For example, you might want to know the century that a date belongs to. This function will return that information. The text returned can be either the starting date of the period in question, the end date of the period in question, or it can be specified as a range (e.g. 1900-1999).
- Minimum FH Version:
- 8.0
- No. of Parameters:
- 4
- Return Type:
- Text. The span of years
- Parameter 1:
- Date
- Parameter 2:
- Number. The length of the span in years. This value will be 100 if you wish to know what century a date belongs to.
- Parameter 3:
- Number. An offset. The start of a period, for a given date, is calculated by dividing the date with the span length, and discarding the remainder. For example, the year 1987, divided by 100 is 19 (the 87 remainder is discarded). If we multiply 19 by the scan length we get 1900. This is fine if you want the range to start in 1900 (i.e. for the range to be 1900-1999). But what if you wanted it to be 1901-2000? In that case, you need an offset. Setting the offset to 1, would move the range forwards, to give you 1901-2000.
- Parameter 4:
- Must be one of the following values:
- START
- END
- RANGE
- Examples:
-
=YearSpan(%INDI.BIRT.DATE%, 100, 0, RANGE) -- for a birth date in 1987, this would return "1900-1999"
=YearSpan(%INDI.BIRT.DATE%, 100, 1, RANGE) -- for a birth date in 1987, this would return "1901-2000"