declare @stdate datetime = '2020-01-02 09:53:05.390',
@eddate datetime = getdate(),
@curtime bigint
set @curtime = datediff(second, @stdate, @eddate)
select acttime = convert(varchar,((@curtime % 86400) / 3600 )) + ':'
+ convert(varchar,(((@curtime % 86400) % 3600 ) / 60 ))+ ':'
+ convert(varchar,(((@curtime % 86400) % 3600 ) % 60 ))
@eddate datetime = getdate(),
@curtime bigint
set @curtime = datediff(second, @stdate, @eddate)
select acttime = convert(varchar,((@curtime % 86400) / 3600 )) + ':'
+ convert(varchar,(((@curtime % 86400) % 3600 ) / 60 ))+ ':'
+ convert(varchar,(((@curtime % 86400) % 3600 ) % 60 ))
0 Comments
if you have any doubts , please let me know