F_YEARSBETWEEN

<< F_AGEINSECONDSTHRESHOLDN | IBExpert UDF Functions | F_MONTHSBETWEEN >>

F_YEARSBETWEEN

 
  • compatibility to GrUDF
  • Compatible with UTF-8
  • Input TIMESTAMP (older) date optionally time 1, TIMESTAMP (newer) date optionally time 2
  • Output INTEGER difference in (integer) years between timestamp 1 and timestamp 2

Example

 select 2 as ISCORRECT, F_YEARSBETWEEN('01.10.2016 15:01:03', '11.10.2018 15:01:03')
 from RDB$DATABASE
 union
 select 3 as ISCORRECT, F_YEARSBETWEEN('11.10.2018 15:01:03', '01.10.2015 15:01:03')
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_YEARSBETWEEN(null, null)
 from RDB$DATABASE;

Expected results:

    ISCORRECT
 ============ ============
       <null>       <null>
            2            2
            3            3

back to top of page
<< F_AGEINSECONDSTHRESHOLDN | IBExpert UDF Functions | F_MONTHSBETWEEN >>