DateDiff
not only work with Date
datatype it even accepts TIME
datatype.
Even if your datatype
is nvarchar
it will work but it should be a valid time
.
Simple Demo
create table time_test(a nvarchar(50),b nvarchar(50))
insert time_test values ('4:00 PM','4:30 PM')
select datediff(minute,a,b) from time_test --30
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…