SUBTRACT_TIMESTAMP_TZ_UDF (TIMESTAMP_TZ, TIMESTAMP_TZ)

Definition

This user-defined function (UDF) converts both inputs to the system session timezone and subtracts the dates (FIRST_DATE - SECOND_DATE) taking 1900-01-01 00:00:00.000 as the zero value. If any value does not include the timezone, the current session timezone is used.

PUBLIC.SUBTRACT_TIMESTAMP_TZ_UDF(FIRST_DATE TIMESTAMP_TZ, SECOND_DATE TIMESTAMP_TZ)

Parameters

FIRST_DATE TIMESTAMP_TZ

The first date to be subtracted from.

SECOND_DATE TIMESTAMP_TZ

The second date to be subtracted to.

Returns

Returns the difference between the two input dates.

Usage example

Input:

SELECT SUBTRACT_TIMESTAMP_TZ_UDF('1900-01-01 00:00:00.000 +0100', '1900-01-01 00:00:00.003 -0100')

Output:

1899-12-31 13:59:59.997 -0800

Last updated