本文介绍了在Oracle SQL中将时间戳转换为日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将时间戳转换为日期?
How can we convert timestamp to date?
该表具有一个start_ts
字段,该字段的格式为timestamp
:
The table has a field, start_ts
which is of the timestamp
format:
'05/13/2016 4:58:11.123456 PM'
我需要查询表并在表中找到最大值和最小值timestamp
,但我无法.
I need to query the table and find the maximum and min timestamp
in the table but I'm not able to.
Select max(start_ts)
from db
where cast(start_ts as date) = '13-may-2016'
但是查询没有返回任何值.
But the query is not returning any values.
请帮助我查找日期的最大时间戳.
Please help me in finding the max timestamp for a date.
推荐答案
CAST(timestamp_expression AS DATE)
例如,查询为:SELECT CAST(SYSTIMESTAMP AS DATE) FROM dual;
这篇关于在Oracle SQL中将时间戳转换为日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!