SQL Date month convert

ubsmail
ubsmail used Ask the Experts™
on
I need to turn a date into a YYMM format. The code I attached works, however I am wondering if there is a simplfied way to do this.
LEFT(RIGHT(CONVERT(CHAR(7), ITEMS.IT_SDATE, 111),5),2) + RIGHT(CONVERT(CHAR(7), ITEMS.IT_SDATE, 111),2) AS ship_Month

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Expert of the Quarter 2010
Expert of the Year 2010
Commented:
sure
convert(char(4), ITEMS.IT_SDATE, 12)

Commented:
I do not think there is better way tod this.
Try this
SUBSTRING(CONVERT(VARCHAR(12), Items.IT_SDATE, 112), 3, 4)

Open in new window

Author

Commented:
why yes that is

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial