F_WORKINGDAYSBETWEEN

<< F_DAYSBETWEEN | IBExpert UDF Functions | F_HOURSBETWEEN >>

F_WORKINGDAYSBETWEEN

 
  • function from adhoc
  • Compatible with UTF-8
  • Input TIMESTAMP (older) date optionally time 1, TIMESTAMP (newer) date optionally time 2, INTEGER weekday don't calculate
  • Output INTEGER difference in (integer) days between timestamp 1 and timestamp 2 less of weekday/s from param 3

weekday: Monday = 1, Thuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 The result is allways positiv. Any order of indexes for weekdays. Only allowed indexes are calculated.

Example

 select 4 as ISCORRECT, F_WORKINGDAYSBETWEEN('12.12.2018', '17.12.2018', 7)
 from RDB$DATABASE
 union
 select 5 as ISCORRECT, F_WORKINGDAYSBETWEEN('18.12.2018', '12.12.2018', 7)
 from RDB$DATABASE
 union
 select -4 as ISCORRECT, F_AGEINWORKINGDAYS('17.12.2018', '12.12.2018', 7)
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_WORKINGDAYSBETWEEN(null, null, null)
 from RDB$DATABASE;

Expected results:

    ISCORRECT
 ============ ============
       <null>       <null>
           -4           -4
            4            4
            5            5

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