A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: Date and Time Functions

date_part, Possible values for the parameter date_part in ASE Date and Time functions

The table below shows possible values for the parameter "date_part" in Date and Time functions and their abbreviations.

Date part Abbreviation Values
year yy 1753 – 9999 (2079 for smalldatetime)
quarter qq 1 – 4
month mm 1 – 12
week wk 1 – 54
day dd 1 – 31
dayofyear dy 1 – 366
weekday dw 1 – 7 (Sun. – Sat.)
hour hh 0 – 23
minute mi 0 – 59
second ss 0 – 59
millisecond ms 0 – 999

Features of the date_part-function "yy"

When specifing years, please note that the abbreviation "yy" of less than 50 interprets as four digit years starting with 2000. "yy" less or greater than 50 will be interpreted as years between 1950 and 1999. So for example a "yy" value of "1" is being interpreted as "2001" or "49" is being interpreted as "2049". On the other hand, a value of "50" is interpreted as "1950" or a value of "79" is interpreted as "1979".

See also:

ASE T-SQL - Aggregate Functions,
Date and Time Functions,
dateadd(),
datediff(),
datename(),
datepart(),
day(),
getdate(),
month(),
style numbers,
year().