meta data for this page
  •  

F_SUBPERIOD

function from adhoc

Entrypoint subperiod compatible with UTF-8


Inputs/Outputs

   Input      CSTRING(254)     period 1 in pattern [d]:h:m:s
              CSTRING(254)     period 2 in pattern [d]:h:m:s
   Output     CSTRING(254)     period 2 subtracted from period 1

Syntax

   Periods could be entered with 2- or 1-digit interval (dd:hh:mm:ss or d:h:m:s).
   Negative periods start with a "-" in front.
   Periods with pattern days:hours:seconds (4 intervals) or hours:minutes:seconds (3 intervals) are allowed.
   The output of periods with less than 3 intervals or containing other characters is <null> or empty string.
   For input also f.e. '0:26:0:0' instead of '1:2:0:0' allowed for 26 hours.
   The output is always in pattern days:hours:minutes:seconds (4 * 2 digit intervalls).
   If the second input period is greater than the first, the output is negative ("-" in front).
   TestSQL
   SELECT '00:00:54:50' AS ISCORRECT, F_SUBPERIOD('0:1:10:0', '0:0:15:10') FROM RDB$DATABASE;
   SELECT '-00:00:54:50' AS ISCORRECT, F_SUBPERIOD('0:0:15:10', '0:1:10:0') FROM RDB$DATABASE;
   SELECT NULL AS ISCORRECT, F_SUBPERIOD(NULL, NULL) FROM RDB$DATABASE;