Skip to main content

DATENAME() Function

Definition The DATENAME() function returns a specified part of a date.  This functions returns the result as a string value.     Syntax DATENAME(interval, date) where interval is required and it is th

Updated over 2 weeks ago

Definition

The DATENAME() function returns a specified part of a date. This functions returns the result as a string value.

Syntax

DATENAME(interval, date)

where interval is required and it is the part to return. This can be one of the following values:

  • year, yyyy, yy = Year

  • quarter, qq, q = Quarter

  • month, mm, m = month

  • dayofyear, dy, y = Day of the year

  • day, dd, d = Day of the month

  • week, ww, wk = Week

  • weekday, dw, w = Weekday

  • hour, hh = hour

  • minute, mi, n = Minute

  • second, ss, s = Second

  • millisecond, ms = Millisecond

And date is required and is the date that will be used.

Example(s)

See how DATENAME can be used to:

Did this answer your question?