F_ADDHOUR

<< F_ADDDAY | IBExpert UDF Functions | F_ADDMINUTE >>

F_ADDHOUR

 

substitutable with DATEADD

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

If parameter 2 is negative, hours to subtract.

Example

 select cast('01.10.2018 18:03:01' as timestamp) as ISCORRECT, F_ADDHOUR('01.10.2018 15:03:01', 3)
 from RDB$DATABASE
 union
 select cast('01.10.2018 12:03:01' as timestamp) as ISCORRECT, F_ADDHOUR('01.10.2018 15:03:01', -3)
 from RDB$DATABASE
 union
 select null as ISCORRECT, F_ADDHOUR(null, null)
 from RDB$DATABASE;

Expected results:

                 ISCORRECT
 ========================= =========================
                    <null>                    <null>
 2018-10-01 12:03:01.0000  2018-10-01 12:03:01.0000
 2018-10-01 18:03:01.0000  2018-10-01 18:03:01.0000

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