Combining this with DATEADD allows you to find out the month name in two months time: : DATENAME « Date Functions « SQL Server / T-SQL Tutorial






16>
17> SELECT DATENAME(mm,DATEADD(mm,2,GETDATE()))
18> GO

------------------------------
December

(1 rows affected)

Year - yy, yyyy
Month - mm, m
Week - wk, ww
Day - dd, d
Hour - hh
Minute - mi, n
quarter - qq
day of year - dy
seconds - ss
milliseconds - ms








10.7.DATENAME
10.7.1.Displaying the String Value for Part of a Date
10.7.2.DATENAME returns date's character string representation: DATENAME(datepart,date)
10.7.3.select DATENAME(day, '2002-09-30 11:35:00')
10.7.4.select DATENAME(month, '2002-09-30 11:35:00')
10.7.5.select DATENAME(year, '2002-09-30 11:35:00')
10.7.6.select DATENAME(hour, '2002-09-30 11:35:00')
10.7.7.select DATENAME(minute, '2002-09-30 11:35:00')
10.7.8.select DATENAME(second, '2002-09-30 11:35:00')
10.7.9.select DATENAME(quarter, '2002-09-30 11:35:00')
10.7.10.select DATENAME(dayofyear, '2002-09-30 11:35:00')
10.7.11.select DATENAME(week, '2002-09-30 11:35:00')
10.7.12.select DATENAME(weekday, '2002-09-30 11:35:00')
10.7.13.select DATENAME(month,'2002-09-30')
10.7.14.Combining this with DATEADD allows you to find out the month name in two months time:
10.7.15.Displaying the String Value for Part of a Date: Show the start Date's day of the week