Translate

Thursday, 20 April 2017

sql : get day,month and year in a date

I have run this query ie today(20 April 2017) is  2017-04-20 14:42:33.093

SELECT getdate()--2017-04-20 14:42:33.093
SELECT datepart(day, getdate())--20   -- Day
SELECT datepart(Month, getdate())--4 --- Month
SELECT datepart(YEAR, getdate())--2017--Year

No comments:

Post a Comment