Dear,
I have two Column Start & End both are Datetime data type.
The Data is
Start End
12:30 15:00
The Total min is 150
i used below query
DATEDIFF(mi, dbo.Trn_Daily3.Dr_TimeStart, dbo.Trn_Daily3.Dr_TimeEnd)
Its giving correct result=150
But when i convert into hour
DATEDIFF(mi, dbo.Trn_Daily3.Dr_TimeStart, dbo.Trn_Daily3.Dr_TimeEnd)/60
then result is 2 but actual 150/60=2.5
How to do it.
Please help on this
Thanks
Basit.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Manas MohapatraRank #182 · 13.2K reputationPosted Nov 19, 2015, 1:32 AM EST
Vinitha TRank #8,005 · 230 reputationPosted Nov 23, 2021, 9:19 AM EST
CAST() function is used to convert any data type value into specified data type
Here datatype may be integer type so results in 2, we can cast it to Float or Decimal to get exact result
Float - approximate data type, round up the value
Decimal - Fixed Precision data type, doesn't round up the value.
SELECT CAST(DATEDIFF(mi, dbo.Trn_Daily3.Dr_TimeStart, dbo.Trn_Daily3.Dr_TimeEnd) AS FLOAT) / 60