Skip to main content

PQL47 (PQL Function Library - CPM 4.7)

SECONDS_BETWEEN

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

Description

SECONDS_BETWEEN computes the difference between two dates in seconds.

Supported input column types: DATE

Output column type: FLOAT

Syntax
SECONDS_BETWEEN ( table.column1, table.column2 )
NULL handling

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

Examples

[1] SECONDS_BETWEEN of two rows.

Query

Column1

SECONDS_BETWEEN ( "Table1"."Column1" , "Table1"."Column2" )

Input

Output

Table1

Column1 : DATE

Column2 : DATE

Sat Jan 01 2000 00:00:59.999

Fri Dec 31 1999 23:59:59.999

Mon May 09 2005 12:01:10.000

Mon May 09 2005 12:01:11.500

Result

Column1 : FLOAT

-60.0

1.5

[2] In this example conversion from DATE input to FLOAT output is demonstrated. The FLOAT output is a count of seconds, which is 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

SECONDS_BETWEEN ( {t 0 } , "Table1"."Date" )

Input

Output

Table1

Date : 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

Result

Column1 : FLOAT

0.0

25.0

-200000.0

2.0E9

See also: