Answer:
There are three methods to get the Month part from given date:
DECLARE @GivenDate datetime
SET @GivenDate='2010-02-22 23:06:38.300'
(1) MONTH(GETDATE()) OutPut: 2
(2) SUBSTRING(CONVERT(varchar(30),GETDATE(),107),1,3) Output: Feb
(3) DatePart(M,GETDATE()) output: 2
Asked In: Many Interviews |
Alert Moderator