DECLARE @time varchar(32), @timenew varchar(32), @pos int SET @time = CONVERT(varchar(32), getdate(),114) SET @pos = 0 WHILE @pos < LEN(@time) BEGIN SET @pos = @pos + 1 IF SUBSTRING(@time, @pos, 1) <> ':' IF @pos = 1 SET @timenew = SUBSTRING(@time, @pos, 1) ELSE SET @timenew = @timenew + SUBSTRING(@time, @pos, 1) END SELECT @timenew>Interesting, it returned a value of 65.