Feb 22

How to convert mm-dd-yyyy to mm-yyyy in sql server

Hi,In this article I will going to explain you how to convert ‘MM-DD-yyyy’ to ‘MMM-yyyy’

Every developer will face problem while converting date-time, I am keeping query to convert Datetime

Eg:  (’12/01/2013 AM 12:00:00′)  to (‘Dec – 2013′)


[code language=”sql”]

SELECT LEFT(DATENAME(MONTH ,CONVERT(VARCHAR(10), ’12/01/2013 AM 12:00:00′,112)),3)

+’ – ‘+ DATENAME(YEAR,CONVERT(VARCHAR(10), ’12/01/2013 AM 12:00:00’, 112))



Dec – 2013



Happy Coding!!!!!


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>