Minutes Difference Same Day (T-SQL)

// Get a time in the format : 8:00 AM
// Returns the minute difference in integer using the current time
// (only works for the same day but you can modify to work for any date).

ALTER FUNCTION [dbo].[GetMinutesDifference](@JustTime varchar(50))
RETURNS int
AS
BEGIN
    DECLARE @MinuteDifference int
	Set     @MinuteDifference = (SELECT DATEDIFF(minute, CONVERT(SMALLDATETIME, CONVERT(VARCHAR(8), GETDATE(), 112) + ' ' + @JustTime) , GETDATE()))
	Return  @MinuteDifference
END