Saturday, December 28, 2013

How to Concatenate Date in T-SQL using custom format?

Try:



DECLARE @t datetime
SET @t = '2011-01-25 07:32:21.000'

SELECT @t, DATEADD(MONTH, DATEDIFF(MONTH,'19000101', @t),'19000101'), -- beginning OF the MONTH

convert(varchar(10),DATEADD(MONTH, DATEDIFF(MONTH,'19000101', @t),'19000101'),120)





For every expert, there is an equal and opposite expert. - Becker's Law





My blog


No comments:

Post a Comment