DATENAME returns date's character string representation: DATENAME(datepart,date) : DATENAME « Date Functions « SQL Server / T-SQL Tutorial






4>
5> SELECT DATENAME(DW,"10/01/97")
6> GO

------------------------------
Wednesday

(1 rows affected)
1>








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