从SQL的时间戳中提取时间 [英] Extracting Time from Timestamp in SQL

查看:640
本文介绍了从SQL的时间戳中提取时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using Redshift and am looking to extract the time from the timestamp.

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

Here is the timestamp: 2017-10-31 23:30:00

我想将时间定为23:30:00

and I would just like to get the time as 23:30:00

有可能吗?

推荐答案

在Redshift中,您只需将值转换为time:

In Redshift you can simply cast the value to a time:

the_timestamp_column::time

或者,您可以使用标准的cast() 操作员:

alternatively you can use the standard cast() operator:

cast(the_timestamp_column as time)

这篇关于从SQL的时间戳中提取时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆