Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.43 KB

unix_timestamp.md

File metadata and controls

45 lines (32 loc) · 1.43 KB
description
Returns the Unix epoch time representation of an ISO 8601 timestamp.

UNIX_TIMESTAMP

Syntax

UNIX_TIMESTAMP() → int64

Examples

{% code title="UNIX_TIMESTAMP example" %}

SELECT UNIX_TIMESTAMP()
-- 1624928208

{% endcode %}

UNIX_TIMESTAMP(date_timestamp_expression varchar) → int64

  • date_timestamp_expression: The timestamp to convert to Unix timestamp. The expected format is ‘YYYY-MM-DD HH:MM:SS’ where HH can be a value 1-24.

Examples

{% code title="UNIX_TIMESTAMP example" %}

SELECT UNIX_TIMESTAMP('2021-12-22 13:44:11')
-- 1640180651

{% endcode %}

UNIX_TIMESTAMP(date_timestamp_expression varchar, format varchar) → int64

  • date_timestamp_expression: The timestamp to convert to Unix timestamp.
  • format: Specify the format of the time, date, or timestamp parameter. For example, ‘YY-MM-DD’ or ‘HH:MM:SS’.

Examples

{% code title="UNIX_TIMESTAMP example" %}

SELECT UNIX_TIMESTAMP('21-12-22', 'YY-MM-DD')
-- 1640131200

{% endcode %}