跳转到内容

将日期/时间格式的时间戳转换为 Unix 时间戳格式。Unix 时间戳表示自 UTC 1970 年 1 月 1 日 00:00:00 以来经过的秒数。

func.to_unix_timestamp(<expr>)
func.to_unix_timestamp('2023-11-12 09:38:18.165575')
┌────────────────────────────────────────────────────────────────┐
│ func.to_unix_timestamp('2023-11-12 09:38:18.165575') │
│ UInt32 │
├────────────────────────────────────────────────────────────────┤
│ 1699781898 │
└────────────────────────────────────────────────────────────────┘
TO_UNIX_TIMESTAMP(<expr>)
参数 说明
<expr> Timestamp

有关时间戳数据类型的详细信息,请参阅 Date & Time。

BIGINT

SELECT
to_unix_timestamp('2023-11-12 09:38:18.165575')
┌─────────────────────────────────────────────────┐
│ to_unix_timestamp('2023-11-12 09:38:18.165575') │
│ UInt32 │
├─────────────────────────────────────────────────┤
│ 1699781898 │
└─────────────────────────────────────────────────┘