本文介绍了将数字转换为时间跨度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将数值转换为时间(HH:MM).
How can i convert numeric value in to time (HH:MM).
推荐答案
declare @time int
set @time = 635
select cast((@time / 60) as varchar(2)) + ' hr : ' + cast((@time % 60) as varchar(2))+' min'
DECLARE @TIME INT
SET @TIME = 635
SELECT CONVERT(VARCHAR(10), @TIME / 100) + ' hours, ' + CONVERT(VARCHAR(10), @TIME % 100) + ' minutes'
或者您可以将其作为两列返回.
Or you could return it as two columns.
DECLARE @TIME INT
SET @TIME = 635
SELECT @TIME / 100 AS [Hours], @TIME % 100 AS [Minutes]
DECLARE @TIME numeric
SET @TIME = 635
select CONVERT(VARCHAR(5),dateadd(MI, -((CAST( @TIME/100 as int)*60)+ RIGHT(@TIME,2)), getdate()),24)
这篇关于将数字转换为时间跨度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!