I have a table consisting of datetime columns "StartTime" and "CompleteTime". Initially, the completeTime column will be NULL until the process completes. And now my requirement is to display hours and minutes as shown below
Exit:
Example: 2:01 h (This means that “2” represents hours and “01” represents minutes)
I tried as below:
Declare @StartDate dateTime = '2016-03-31 04:59:11.253'
Declare @EndDate dateTime = GETUTCDATE()
SELECT REPLACE(CONVERT(VARCHAR,CAST(DATEDIFF(second, @StartDate,
ISNULL(GETUTCDATE(),@EndDate)) / 36000.0 AS DECIMAL(9,2))) + ' hr','.',':')
Output:
0:05 hr
Required Conclusion:
0:32 hr
Note: Hi, giving a negative mark, check my request once. I already referred to some links related to this, but it will not work.