Cloud

Overview

Timestamp functions return a date-time value based on a specified timestamp/interval. Redpanda SQL supports the timestamp functions:

Functions Description

current_timestamp()

Returns the current date and time as a timestamp data type.

format_timestamp()

Modifies the current timestamp into a different format.

unix_seconds()

Converts a given timestamp to a UNIX timestamp in seconds.

unix_millis()

Converts a given timestamp to a UNIX timestamp in milliseconds.

unix_micros()

Converts a given timestamp to a UNIX timestamp in microseconds.

timestamp_seconds()

Converts a UNIX timestamp in seconds to a timestamp.

timestamp_millis()

Converts a UNIX timestamp in milliseconds to a timestamp.

timestamp_micros()

Converts a UNIX timestamp in microseconds to a timestamp.

timestamp_trunc()

Truncates a given timestamp to the nearest time part. Supported time parts are YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND

EXTRACT

Extracts some part of a specified timestamp or interval.

to_timestamp()

Converts a string into a timestamp based on the provided format.

date_trunc()

Truncates intervals or timestamps/time zones to a specified field.

to_char() from Timestamp

Formats a timestamp into a string using a given format.