F_ADDPERIOD

<< F_INCDATETIME | IBExpert UDF Functions | F_SUBPERIOD >>

F_ADDPERIOD

 
  • function from adhoc
  • Compatible with UTF-8
  • Input VARCHAR(254) period 1 in pattern [d]:h:m:s, VARCHAR(254) period 2 in pattern [d]:h:m:s
  • Output VARCHAR(254) sum of period 1 and 2

Periods could be entered with 2- or 1 digits interval (dd:hh:mm:ss or d:h:m:s). Negative periods starts with a "-" in front. Periods with pattern days:hours:minutes:seconds (4 intervalls) or hours:minutes:seconds (3 intervalls) are allowed. The output of periods with less than 3 intervalls or containing other characters is <null> or empty string. For input also f.e. '0:26:0:0' instead of '1:2:0:0' alllowed for 26 hours. The output is allways in pattern days:hours:minutes:seconds (4 * 2 digit intervalls)

Example

 SELECT '00:01:25:10' AS ISCORRECT, F_ADDPERIOD('0:1:10:0', '0:0:15:10') FROM RDB$DATABASE;

Expected results:

 ISCORRECT   F_ADDPERIOD                                                                                                                                           
 =========== ============================================================================
 00:01:25:10 00:01:25:10 

Example

 SELECT '00:01:25:10' AS ISCORRECT, F_ADDPERIOD('01:10:00', '00:15:10') FROM RDB$DATABASE;

Expected results:

 ISCORRECT   F_ADDPERIOD                                                                                                                                           
 =========== =============================================================================
 00:01:25:10 00:01:25:10 

Example

 SELECT '00:00:54:50' AS ISCORRECT, F_SUBPERIOD('0:1:10:0', '0:0:15:10'), F_ADDPERIOD('0:1:10:0', '-0:0:15:10') FROM RDB$DATABASE;

Expected results:

 ISCORRECT   F_SUBPERIOD      F_ADDPERIOD                                                                                                                                                                                                                
 =========== ================ ======================================
 00:00:54:50 00:00:54:50      00:00:54:50  

Example

 SELECT NULL AS ISCORRECT, F_ADDPERIOD(NULL, NULL) FROM RDB$DATABASE;

Expected results:

 ISCORRECT F_ADDPERIOD                                                                                                                                             
 ========= ===============================================================================
 <null>    <null>      

back to top of page
<< F_INCDATETIME | IBExpert UDF Functions | F_SUBPERIOD >>