F_AGEINYEARSTHRESHOLD

<< F_AGEINYEARSTHRESHOLD | IBExpert UDF Functions | F_AGEINMONTHSTHRESHOLDN >>

F_AGEINYEARSTHRESHOLD

 
  • function from adhoc
  • Compatible with UTF-8
  • Input TIMESTAMP (older) date optionally time 1, TIMESTAMP (newer) date optionally time 2, INTEGER min. value, INTEGER min. value is used (0 = no, 1 = yes), INTEGER max. value, INTEGER max. value is used (0 = no, 1 = yes)
  • Output INTEGER difference in (integer) years between timestamp 1 and timestamp 2

Example

 select 3 as ISCORRECT, F_AGEINYEARSTHRESHOLD('01.10.2015 15:01:03', '01.12.2018 15:03:03', 5, 0, 10, 0)
 from RDB$DATABASE
 union
 select 5 as ISCORRECT, F_AGEINYEARSTHRESHOLD('01.10.2015 15:01:03', '01.12.2018 15:03:03', 5, 1, 10, 0)
 from RDB$DATABASE
 union
 select 3 as ISCORRECT, F_AGEINYEARSTHRESHOLD('01.10.2015 15:01:03', '01.12.2018 15:03:03', 5, 0, 10, 1)
 from RDB$DATABASE
 union
 select 10 as ISCORRECT, F_AGEINYEARSTHRESHOLD('01.10.2005 15:01:03', '01.12.2018 15:03:03', 5, 0, 10, 1)
 from RDB$DATABASE
 union
 select 10 as ISCORRECT, F_AGEINYEARSTHRESHOLD('01.10.2005 15:01:03', '01.12.2018 15:03:03', 5, 1, 10, 1)
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_AGEINYEARSTHRESHOLD(null, null, null, null, null, null)
 from RDB$DATABASE;

Expected results:

    ISCORRECT
 ============ ============
       <null>       <null>
            3            3
            5            5
           10           10

back to top of page
<< F_AGEINYEARSTHRESHOLD | IBExpert UDF Functions | F_AGEINMONTHSTHRESHOLDN >>