Nazar Tereshkovych
Nazar Tereshkovych

Reputation: 1472

T SQL: How get all minutes from Time type

I have the following code and I want get all minutes from time type.

declare @time time
set @time = '01:30'

declare @minutes int

--select @minutes = convert time to minutes here

select @minutes -- @minutes == 90

Please help.

Upvotes: 10

Views: 10074

Answers (1)

Alex K.
Alex K.

Reputation: 175768

The difference between @time & midnight;

set @minutes = datediff(minute, '00:00:00', @time)

Upvotes: 24

Related Questions