Monday, 30 April 2012

Get the Day Name from Date In SQL SERVER

In SQL
select datename (dw, '4/30/2012') as NameOfDay  --dw is refer as DATEPART
 the result is 'Monday'

 From this we can find the day of Date...
datepart
Is the parameter that specifies the part of the date to return. The following table lists dateparts and abbreviations recognized by Microsoft SQL Server 2005.
Datepart Abbreviations
year
yy, yyyy
quarter
qq, q
month
mm, m
dayofyear
dy, y
day
dd, d
week
wk, ww
weekday
dw
hour
hh
minute
mi, n
second
ss, s
millisecond
ms
The weekday (dw) datepart returns the day of the week, such as Sunday, Monday, and so on.
 http://msdn.microsoft.com/en-us/library/ms174395%28v=sql.90%29.aspx


No comments:

Post a Comment