Skip to main content

Date & Time

Usage

A Date & Time filter is a UI control for selecting an instant in time.

image-300 image-300

A date-time filter is used in a condition on a SQL date-time expression.

Syntax
{[<date_time_expr>]=<filter_variable_name>}

The <date_time_expr> must either be an expression of type TIMESTAMP (or a database-specific equivalent) or an expression that can be cast to a TIMESTAMP. The filter input value that the expression is compared to is always generated by Cluvio as a database-specific date-time literal, as in TIMESTAMP '2023-04-12T10:58:12'. For example, the following parameterised SQL query

SELECT *
FROM logs
WHERE {log_timestamp=my_date_time_filter}

with a selected input timestamp of 2023-04-12T10:58:12 results in database-specific SQL similar to the following:

SELECT *
FROM logs
WHERE log_timestamp = TIMESTAMP '2023-04-12T10:58:12'
Date-Time Equality

A Date & Time filter only creates date-time equality conditions in SQL. For filtering date-time ranges, see the Date & Time Range filter instead.

Configuration

To configure a Date & Time filter, select the Date / Time UI control type in the filter definition dialog.

Edit Filter Edit Filter

Use the Configuration tab to set a default value and further configuration options.

Value Selectors

A value selector allows to tap into SQL value expressions associated with the selected date & time.

Date-Time Value

SELECT {my_date_time.value}

The .value selector produces a database-specific date-time value expression or NULL if no value is selected.

Selected

SELECT *
FROM event
WHERE
CASE
WHEN {my_date_time.selected} = TRUE THEN {starttime=my_date_time}
ELSE starttime = TIMESTAMP '2024-01-01T00:00:00'
END

The .selected selector produces a database-specific boolean expression that is true when a value is selected for the filter, false otherwise.