Hi,
You could use next kind of code
DECLARE @CURRENTDATE AS DATETIME SET @CURRENTDATE = GETDATE()
SELECT CONVERT(VARCHAR(4),YEAR(@CURRENTDATE)) + '-' +
REPLICATE('0',2-LEN(CONVERT(VARCHAR(2),DAY(@CURRENTDATE)))) +
CONVERT(VARCHAR(2),DAY(@CURRENTDATE)) + '-' +
REPLICATE('0',2-LEN(CONVERT(VARCHAR(2),MONTH(@CURRENTDATE)))) +
CONVERT(VARCHAR(2),MONTH(@CURRENTDATE)) + ' ' +
REPLICATE('0',2-LEN(CONVERT(VARCHAR(2),DATEPART(hh,@CURRENTDATE)))) +
CONVERT(VARCHAR(2), DATEPART(hh,@CURRENTDATE)) + ':' +
REPLICATE('0',2-LEN(CONVERT(VARCHAR(2),DATEPART(n,@CURRENTDATE)))) +
CONVERT(VARCHAR(2), DATEPART(n,@CURRENTDATE))
If you still need to keep it as a date datatype, then there is no point to
convert it in a SP, because you will see this date on a client side in a
local format, that set in a regional settings of the client's PC