Sunday, December 4, 2011

Get datetime in YYYYMM format–Sql Server

 

I need to get the date in YYYYMM format i.e. ‘2011-01-23’ becomes ‘201101’

declare @date date = '2016-11-23'
select convert(varchar(6), @date, 112)

No comments:

Post a Comment