Oracle将秒数转换为小时:分钟:秒 [英] Oracle Convert Seconds to Hours:Minutes:Seconds
本文介绍了Oracle将秒数转换为小时:分钟:秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从给定的总秒数值中以Hours:Minutes:Seconds格式显示用户可用时间.如果您知道ORACLE函数可以执行相同的操作,则不胜感激.我正在使用Oracle.
I have a requirement to display user available time in Hours:Minutes:Seconds format from a given total number of seconds value. Appreciate if you know a ORACLE function to do the same. I'm using Oracle.
谢谢您的时间.
推荐答案
如果您只是想将给定的秒数转换为HH:MI:SS格式,则应该这样做
If you're just looking to convert a given number of seconds into HH:MI:SS format, this should do it
SELECT
TO_CHAR(TRUNC(x/3600),'FM9900') || ':' ||
TO_CHAR(TRUNC(MOD(x,3600)/60),'FM00') || ':' ||
TO_CHAR(MOD(x,60),'FM00')
FROM DUAL
其中x
是秒数.
这篇关于Oracle将秒数转换为小时:分钟:秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文