PostgreSQL:将时间戳转换为时间 - 或仅从时间戳列中检索时间

Lar*_*sen 10 postgresql

我想要的是与此相同的东西:

select to_time( to_timestamp ( '03.04.2014 12:34:00', 'DD.MM.YYYY HH24:MI:SS' ) )
Run Code Online (Sandbox Code Playgroud)

这里的问题是to_time不存在.我想要这个结果

12:34:00 (without the date)
Run Code Online (Sandbox Code Playgroud)

这可能吗 ?

a_h*_*ame 23

select timestamp '2014-04-03 12:34:00'::time
Run Code Online (Sandbox Code Playgroud)

我更喜欢ANSI日期/时间戳文字,因为它们比写入更短 to_timestamp()

以上相当于:

select to_timestamp ('03.04.2014 12:34:00', 'DD.MM.YYYY HH24:MI:SS')::time
Run Code Online (Sandbox Code Playgroud)

::time是Postgres用于铸造价值的简写符号.

如果您需要,以下将是完整的ANSI SQL:

select cast(timestamp '2014-04-03 12:34:00' as time)
Run Code Online (Sandbox Code Playgroud)