(IYR4(date)) or (IYR4(datetime))
Where arg is a value that has a DATE or DATETIME data type, IYR4 always returns a four-digit integer value for the year. This is different from the IYR function which depends on how the DATE format is set.
This function will allow users to capture four digit year, regardless of the DATE FORMAT or DATE SEQUENCE settings. Results will be based on the DATE YEAR and CENTURY settings. See DATE format.
Example 01 (Database with settings):
DATE FORMAT: MM/DD/YYYY
DATE SEQ: MMDDYY
DATE YEAR: 30
DATE CENT: 19
SET VAR v1 = (IYR4(.#DATE))
Variable v1 will return the four digit INTEGER value of 2000
Example 02:
SET VAR v2 DATETIME = ('06/26/2000 08:00')
SET VAR v3 = (IYR4(.v2))
Variable v3 will return the four digit INTEGER value of 2000
Example 03 (Database with settings):
DATE FORMAT: MM/DD/YY
DATE SEQ: MMDDYY
DATE YEAR: 30
DATE CENT: 19
SET VAR v1 = (IYR4(.#DATE))
Variable v1 will ALSO return the four digit INTEGER value of 2000
Example 04:
SET VAR v2 DATETIME = ('06/26/00 08:00')
SET VAR v3 = (IYR4(.v2))
Variable v3 will ALSO return the four digit INTEGER value of 2000