Oracle 将秒转换为小时:分钟:秒 [英] Oracle Convert Seconds to Hours:Minutes:Seconds

查看:57
本文介绍了Oracle 将秒转换为小时:分钟:秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从给定的总秒数值中以小时:分钟:秒格式显示用户可用时间.如果您知道一个 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屋!

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