I've created a function for converting minutes (smallint) to time (varchar(5)), like 58 -> 00:58.
set QUOTED_IDENTIFIER ON
GO
Create FUNCTION [dbo].[IntToMinutes]
(
    @m smallint
)
RETURNS nvarchar(5)
AS
BEGIN
    DECLARE @c nvarchar(5)
     SET @c = CAST((@m / 60) as varchar(2)) + ':' + CAST((@m % 60) as varchar(2))
     RETURN @c
END
The problem is when there are less than 10 minutes in time, like 9. The result of this function is 0:9. I want that the format is 00:09.
How can I do that?