MSSQL Server Date Manipulations (datename)

In MSSQL Server its necessary for to see weekname(sunday,monday,etc..) and, weekcount and even some times its important to the day count in an year and most of DBA s directly count these , but SQL has a lot of built in Functions

have a look at the datename function and its parameters

dateepart Abbreviations
===============================
Year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week ww,dw
Hour hh
minute mi, n
second ss, s
millisecond ms

USAGE
======
select datename(wk,getdate()),datename(dw,getdate()),datename(dy,getdate())

try yourself for more

  • Share/Bookmark