从 SQL 中的时间戳中提取时间

use*_*376 2 sql amazon-redshift

我正在使用 Redshift,希望从时间戳中提取时间。

这是时间戳:2017-10-31 23:30:00

我只想得到 23:30:00 的时间

那可能吗?

小智 9

在 Redshift 中,您可以简单地将值转换为 a time

the_timestamp_column::time
Run Code Online (Sandbox Code Playgroud)

或者您可以使用标准cast() 运算符:

cast(the_timestamp_column as time)
Run Code Online (Sandbox Code Playgroud)