date in MMYY format
-
Wednesday, February 25, 2009 11:26 PMHi ,
Can any one tell me how to write date time in Month and Year format?
Ex;
01.01.09 00:00:00 should be Jan 2009
Thanks
shamen
All Replies
-
Wednesday, February 25, 2009 11:35 PM
Look at the DATEPART in BOL
-
Thursday, February 26, 2009 2:16 AMModerator
declare @dt DATETIME SET @dt='01.01.09 00:00:00' SELECT STUFF(CONVERT(VARCHAR(12),@dt,107),4,4, ' ') as MMYY
--Jan 2009- Marked As Answer by Jinchun ChenMicrosoft Employee, Moderator Friday, February 27, 2009 1:39 AM
-
Thursday, February 26, 2009 4:10 AMModerator
SELECT
RIGHT(CONVERT(VARCHAR(12),getdate(),106),8)
Mangal Pardeshi
SQL With Mangal
Technical Skill is the mastery of complexity, while Creativity is the master of simplicity- Marked As Answer by Jinchun ChenMicrosoft Employee, Moderator Friday, February 27, 2009 1:39 AM
-
Friday, February 27, 2009 1:42 AMModerator
Hi shamen,
limno and Magal's answer is good.
But if you are not in the location "us_english", please add " SET LANGUAGE 'us_english' " at the begin of the statement.
Thanks,
Jin
Jin Chen - MSFT

