F_ADDMONTH

<< F_ADDYEAR | IBExpert UDF Functions | F_ADDWEEK >>

F_ADDMONTH

 

substitutable with DATEADD

  • compatibility to FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP, GrUDF
  • Compatible with UTF-8
  • Input TIMESTAMP date optionally time, INTEGER month to add
  • Output TIMESTAMP adds month to timestamp

If parameter 2 is negative, month to subtract.

Example

 select cast('01.03.2019 15:03:01' as timestamp) as ISCORRECT, F_ADDMONTH('01.10.2018 15:03:01', 5)
 from RDB$DATABASE
 union
 select cast('01.07.2018 15:03:01' as timestamp) as ISCORRECT, F_ADDMONTH('01.10.2018 15:03:01', -3)
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_ADDMONTH(null, null)
 from RDB$DATABASE;

Expected results:

                 ISCORRECT
 ========================= =========================
                    <null>                    <null>
 2018-07-01 15:03:01.0000  2018-07-01 15:03:01.0000
 2019-03-01 15:03:01.0000  2019-03-01 15:03:01.0000

back to top of page
<< F_ADDYEAR | IBExpert UDF Functions | F_ADDWEEK >>