Search this blog

Tuesday, June 9, 2009

Datepart Argument Lists in SQL

SQL Server Contains a Function Named as "DatePart", It Returns an integer that represents the specified datepart of the specifieddate.

Syntax of DatePart Function:

DATEPART ( datepart , date )

The following table lists all valid datepart arguments and its Abbreviations, you can pass both to this function to extract part of the date

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

1 comment: