F_ADDWEEK

<< F_ADDMONTH | IBExpert UDF Functions | F_ADDDAY >>

F_ADDWEEK

 

substitutable with DATEADD

  • function from adhoc
  • Compatible with UTF-8
  • Input TIMESTAMP date optionally time, INTEGER weeks to add
  • Output TIMESTAMP adds weeks to timestamp

If parameter 2 is negative, weeks to subtract.

Example

 select cast('22.10.2018 15:03:01' as timestamp) as ISCORRECT, F_ADDWEEK('01.10.2018 15:03:01', 3)
 from RDB$DATABASE
 union
 select cast('10.09.2018 15:03:01' as timestamp) as ISCORRECT, F_ADDWEEK('01.10.2018 15:03:01', -3)
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_ADDWEEK(null, null)
 from RDB$DATABASE;;

Expected results:

                 ISCORRECT
 ========================= =========================
                    <null>                    <null>
 2018-09-10 15:03:01.0000  2018-09-10 15:03:01.0000
 2018-10-22 15:03:01.0000  2018-10-22 15:03:01.0000

back to top of page
<< F_ADDMONTH | IBExpert UDF Functions | F_ADDDAY >>