Hi Developers,
Convert this date 2022-11-06 to 06 - Nov - 22 in Sql Query
Input = 2022-11-06
Output = 06 - Nov - 22
If anyone know kindly suggest me to do this task.
Thanks & Regards
Paul.S
Hi Developers,
Convert this date 2022-11-06 to 06 - Nov - 22 in Sql Query
Input = 2022-11-06
Output = 06 - Nov - 22
If anyone know kindly suggest me to do this task.
Thanks & Regards
Paul.S
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit MohantyRank #112 · 20K reputationPosted Nov 24, 2022, 3:58 AM EST
Try this
DECLARE @Existingdate DATETIME = '2022-11-06' SELECT REPLACE(CONVERT(VARCHAR, @Existingdate, 6), ' ', '-') AS [DD-MMM-YY]Vishal JoshiRank #377 · 6.7K reputationPosted Nov 24, 2022, 5:54 AM EST
Hello Paul,
Please try the below SQL Statement to get the expected result.
DECLARE @Orignaldate DATETIME = '2022-11-06' SELECT FORMAT (@Orignaldate, 'dd-MMM-yy') as FormattedDateNote: Above Query will start support from SQL Server 2012.
Thanks
Vishal