F_AGEINWEEKSTHRESHOLDISO

<< F_AGEINWEEKSTHRESHOLD | IBExpert UDF Functions | F_AGEINWEEKSTHRESHOLDN >>

F_AGEINWEEKSTHRESHOLDISO

 
  • 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) weeks between timestamp 1 and timestamp 2

ISO-version of F_AGEINWEEKSTHRESDHOLD. Monday is 1st day of week. If the two dates are in the same week, the return value is 0.

Example

 select 19 as ISCORRECT, F_AGEINWEEKSTHRESHOLDISO('01.06.2018 15:01:21','15.10.2018 15:01:21', 5, 0, 10, 0)
 from RDB$DATABASE
 union
 select 5 as ISCORRECT, F_AGEINWEEKSTHRESHOLDISO('01.01.2018 15:01:21', '15.01.2018 15:01:21', 5, 1, 10, 0)
 from RDB$DATABASE
 union
 select 10 as ISCORRECT, F_AGEINWEEKSTHRESHOLDISO('01.01.2018 15:01:21', '15.05.2018 15:01:21', 5, 0, 10, 1)
 from RDB$DATABASE
 union
 select -33 as ISCORRECT, F_AGEINWEEKSTHRESHOLDISO('01.01.2019 15:01:21', '15.05.2018 15:01:21', 5, 0, 10, 1)
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_AGEINWEEKSTHRESHOLDISO(null, null, null, null, null, null)
 from RDB$DATABASE;

Expected results:

    ISCORRECT
 ============ ============
       <null>       <null>
          -33          -33
            5            5
           10           10
           19           19

back to top of page
<< F_AGEINWEEKSTHRESHOLD | IBExpert UDF Functions | F_AGEINWEEKSTHRESHOLDN >>