Sql Server dateparts values and abbreviations

SQL Server DATEPART() Function

The DATEPART() function gives a part from date or time like day,month,date, hour minute or second etc.

We can manipulate datetime values with date functions. We must enclose datetime values passed between single quotation marks or double quotation marks. Some functions require a parameter which is known as datepart.Table is given below with the datepart values and their abbrivations.




datepart Abbrevation Values
year yy 1753-9999
quater qq 1-4
month mm 1-12
week wk  0-53
weekday dw 1-7 (Sun-Sat)
day dd 1-31
day of year dy 1-366
hour hh 0-23
minute mi 0-59
second ss 0-59
millisecond ms 0-999


In next tutorial Sql server date function we shall learn use above dateparts