我正在使用 Redshift 并希望从时间戳中提取时间。
这是时间戳:2017-10-31 23:30:00
我只想把时间设为 23:30:00
我尝试使用 cast(the_timestamp_column as time)
但遇到此错误消息:error message: Function ""time"(timestamp without time zone)" not supported.
最佳答案
使用 to_char
使用适当的格式掩码来提取时间戳的时间分量:
select to_char(the_timestamp_column, 'HH24:MI:SS')
from your_table;
Demo
关于sql - 从 Redshift 中的时间戳中提取时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47117827/