Answer:
There are two methods to get the Year part from given date:
DECLARE @GivenDate datetime
SET @GivenDate='2010-02-22 23:06:38.300'
(1) Year(GETDATE()) Output: 2010
(2) DatePart(yy,GETDATE()) Output: 2010
Asked In: Many Interviews |
Alert Moderator