我正在尝试compare the differences between two dates.
我使用datediff
函数来比较它们之间的差异,但我希望它返回hh:mm:ss
而不是十进制值。下面是代码。
,DATEDIFF (D,sr.Start_DATE + sr.Start_time, SR.End_DATE + sr.END_time)as [DATEdiff]
,CAST ((sr.End_Date + sr.End_Time) - (sr.Start_Date + sr.Start_Time) as float) AS [Decimal days]
,round(CAST ((sr.End_Date + sr.End_Time) - (sr.Start_Date + sr.Start_Time) as float),0,1) [Real days]
,CAST ((SR.END_DATE + SR.END_TIME) - (SR.START_DATE + SR.START_TIME) AS FLOAT)
-
round(CAST((SR.End_Date + SR.End_Time) - (SR.START_DATE + SR.START_TIME) AS FLOAT),0,1) as [decimal HH:MM]
--- Converting the decimal hours and minutes to real hours and minutes
--,CAST (DATEDIFF( sr.End_Date , sr.End_Time) - (sr.Start_Date + sr.Start_Time),0) as time(0))
,CONVERT (varchar, DATEadd(MS,12 * 1000, 0),108)
请提出任何建议。