a function to convert a date time value what ever it is to hh:mm:ss format.
2007-10-02 (first published: 2002-06-20)
15,454 reads
a function to convert a date time value what ever it is to hh:mm:ss format.
CREATE FUNCTION BP_Select_HHMMSS(@DateTime DATETIME) RETURNS VARCHAR(50) AS BEGIN DECLARE @RetVal VARCHAR(50) DECLARE @hh varchar(3),@mi varchar(3),@ss varchar(3) select @hh=datepart(hh,@DateTime) select @mi=datepart(mi,@DateTime) select @ss=datepart(ss,@DateTime) if(len(@hh)<2) set @hh='0'+@hh if(len(@mi)<2) set @mi='0'+@mi if(len(@ss)<2) set @ss='0'+@ss select @RetVal= @hh + ':'+ @mi + ':' + @ss RETURN(@RetVal) END