Convert Date format into DD/MMM/YYYY format in SQL Server

Krish KvR picture Krish KvR · Jun 20, 2013 · Viewed 954.5k times · Source

I have a query in SQL, I have to get a date in a format of dd/mm/yy

Example: 25/jun/2013.

How can I convert it for SQL server?

Answer

Jonathan Lonowski picture Jonathan Lonowski · Jun 20, 2013

I'm not sure there is an exact match for the format you want. But you can get close with convert() and style 106. Then, replace the spaces:

SELECT replace(convert(NVARCHAR, getdate(), 106), ' ', '/')