数学差 真丢人
写个函数搞半天,还得用笔画
ALTER FUNCTION [dbo].[FN_SecondToString]
(
@second int --秒
)
RETURNS NVARCHAR(50)
AS
BEGIN
DECLARE @Result NVARCHAR(100)
Declare @d int
Declare @h int
Declare @m int
Declare @s int
set @d=@second/3600/24
set @h=(@second-@d*3600*24)/3600
set @m=(@second-@d*3600*24-@h*3600)/60
set @s=(@second-@d*3600*24-@h*3600)%60
select @Result= convert(varchar(50),@d)+'天'
+right(REPLICATE('0',1)+convert(varchar(50),@h),2)+'时'
+right(REPLICATE('0',1)+convert(varchar(50),@m),2)+'分'
+right(REPLICATE('0',1)+convert(varchar(50),@s),2)+'秒'
RETURN @Result
END