create FUNCTION [dbo].[IsValidStringTime] (@TimeString NVARCHAR(10))
RETURNS BIT
AS
/*
  Function which returns True if input is a valid string time

  LOG:
  20241122 OFB: Created.
*/
BEGIN
    RETURN CASE 
        WHEN @TimeString LIKE '[0-2][0-9]:[0-5][0-9]' 
             AND TRY_CONVERT(TIME, @TimeString) IS NOT NULL THEN 1
        ELSE 0
    END;
END;
GO

