Skip to main content

PQL47 (PQL Function Library - CPM 4.7)

ADD_SECONDS

Applies to: CELONIS 4.0 CELONIS 4.2 CELONIS 4.3 CELONIS 4.4 CELONIS 4.5 CELONIS 4.6 CELONIS 4.7

Description

ADD_SECONDS adds a given number of seconds to a given date.

Supported input column types: base_column -> DATE, seconds_column -> INT

Output column type: DATE

Syntax
ADD_SECONDS ( table.base_column, table.seconds_column )
NULL handling

If any parameter is NULL, the result is NULL as well.

Date range: If a result of type DATE is outside the interval from the year 1400 CE (including) to the year 10000 CE (excluding), it will normally be mapped to NULL. This is not the case for this function:

  • Results outside the interval will still be DATE values.

  • However there are no longer any guarantees with regard to the correctness of the resulting values outside the interval.

Examples

[1] Simple example for ADD_SECONDS.

Query

Column1

ADD_SECONDS ( "Table1"."Base_Column" , "Table1"."Second_Column" )

Input

Output

Table1

Base_Column : DATE

Second_Column : INT

Mon Jan 01 2018 00:00:00.000

60

Mon Jan 01 2018 00:00:00.000

1

Mon Jan 01 2018 00:00:00.000

0

Mon Jan 01 2018 00:00:00.000

-1

Result

Column1 : DATE

Mon Jan 01 2018 00:01:00.000

Mon Jan 01 2018 00:00:01.000

Mon Jan 01 2018 00:00:00.000

Sun Dec 31 2017 23:59:59.000

[2] In this example conversion from INT input to DATE output is demonstrated. The INT input is a count of seconds, and is interpreted as the offset to the Unix epoch (1970-01-01T00:00:00Z in ISO 8601 notation). In the query, the Unix epoch is represented by the DATE constant {t 0}:

Query

Column1

ADD_SECONDS ( {t 0 } , "Table1"."Seconds" )

Input

Output

Table1

Seconds : INT

0

25

-200000

2000000000

Result

Column1 : DATE

Thu Jan 01 1970 00:00:00.000

Thu Jan 01 1970 00:00:25.000

Mon Dec 29 1969 16:26:40.000

Wed May 18 2033 03:33:20.000