sql - How to get the difference between two datetimes in hours and minutes -


if have 2 datetimes :

transtime_in, transtime_out 

how difference between datetimes in following format :

hh:mm 

i use

datediff(hour, transtime_in, transtime_out)  

but hours .

try 1 -

query:

declare        @transtime_in datetime     , @transtime_out datetime  select        @transtime_in = '2013-05-19 08:58:07.000'     , @transtime_out = '2013-05-19 16:40:53.000'  select left(convert(varchar(10), @transtime_out - @transtime_in, 108), 5) 

output:

----- 07:42 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -