0
Hi All, please help me how to convert dd/mm/yyyy to mm/yyyy in MS SQL server
i have column in the table having values 1/11/2019,2/11/2019,3/11/2019....i need another column like 11/2019,11/2019,11/2019... month wise...how to convert dd/mm/yyyy to mm/yyyy in MS SQL server.... thanks in advance
1 Réponse
+ 3
declare @dt datetime = GETDATE()
SELECT LEFT('0' + CAST(MONTH(@dt) as varchar(2)),2) + '-' + CAST(YEAR(@dt) as char(4))