F_WEEKSBETWEENISO

<< F_WEEKSBETWEEN | IBExpert UDF Functions | F_DAYSBETWEEN >>

F_WEEKSBETWEENISO

 
  • function from adhoc
  • Compatible with UTF-8
  • Input TIMESTAMP (older) date optionally time 1, TIMESTAMP (newer) date optionally time 2
  • Output INTEGER difference in (integer) weeks between timestamp 1 and timestamp 2

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

Example

 select 2 as ISCORRECT, F_WEEKSBETWEENISO('02.10.2018 15:01:03', '17.10.2018 15:01:03')
 from RDB$DATABASE
 union
 select 1 as ISCORRECT, F_WEEKSBETWEENISO('11.10.2018 15:01:03', '01.10.2018 15:01:03')
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_WEEKSBETWEENISO(null, null)
 from RDB$DATABASE;

Expected results:

    ISCORRECT
 ============ ============
       <null>       <null>
            1            1
            2            2

back to top of page
<< F_WEEKSBETWEEN | IBExpert UDF Functions | F_DAYSBETWEEN >>