Vinodtiru Vinodtiru - 1 month ago 6
SQL Question

Date Format conversion in SQL

I want to convert date format from 01/09 to January 2009 , 09/03 to September 2003 etc. Is this possible in SQL? Please let me know if there is a API for the same.

Answer

if you have a DateTime column in your table, it's possible

SELECT DATENAME(MM, YOUR_DATE_COLUMN) + ' ' + CAST(YEAR(YOUR_DATE_COLUMN) AS VARCHAR(4)) AS [Month YYYY]

http://www.sql-server-helper.com/tips/date-formats.aspx

Comments