Convert Current Date to MSSQL format

Member

adelia_boyer

by adelia_boyer , in category: SQL , 22 days ago

Convert Current Date to MSSQL format 🤗

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
SET @DD = DATEPART(dd, GETDATE())
SET @MM = DATEPART(mm, GETDATE())
SET @YYYY = DATEPART(yyyy, GETDATE())

IF LEN(@DD) = '1'
	BEGIN
		SET @DD = '0' + @DD
	END
IF LEN(@MM) = '1'
	BEGIN
		SET @MM = '0' + @MM
	END

SET @DT_D = @DD + '.' + @MM + '.' + @YYYY


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers