如何只显示oracle中的时间? [英] how to show only the time in oracle?
本文介绍了如何只显示oracle中的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有日期字段的表.当我运行查询时,我看到:
I have table that has date field. When I run a query, I see this:
01/10/2009 22:10:39
01/10/2009 22:10:39
如何只检索时间(IE:22:10:39)
How can I retrieve only the time (IE: 22:10:39)
推荐答案
你可以试试这个:
SELECT TO_CHAR(yourval, 'DD-MON-YYYY HH:MI:SS') FROM yourtable;
SELECT TO_CHAR(yourval, 'HH:MI:SS') FROM yourtable;
正如@steven 所指出的,要使用 24 小时风格
as @steven pointed out, to have 24 hours style use
SELECT TO_CHAR(yourval, 'HH24:MI:SS') FROM yourtable;
这篇关于如何只显示oracle中的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文