I have a problem with calculating average time. This is the case: i have multiple rows, in each row there is data in time format so I need to calculate an average time of al
This may be useful in this and similar scenarios.
Below will convert the date/time to a number of minutes since midnight. In other words time expressed as an integer. You can do an average on that and then convert back to time.
declare @dt datetime = GETDATE();
select DATEDIFF(minute, dateadd(dd, datediff(dd, 0, @dt), 0), @dt);
--DATEDIFF(minute, [date without time i.e. midnight], [date/time of interest])