Return a part of a date.

`DATEPART(interval, date, [firstdayofweek, firstweekofyear])`

- interval - required, string that indicates the interval of time to return
- date - required, date to evaluate
- firstdayofweek - [OPTIONAL] constant that indicates the first day of the week
- firstdayofyear - [OPTIONAL] constant that indicates the first week of the year

`DATEPART("yyyy", "11/14/2018")`

The date is the date to be used in the calculation and this example returns 2018.

`DATEPART("w", "11/14/2018")`

The DATEPART function can be used to get the day of the week of a date. The "w" argument specifies that the day of the week is to be returned. The date is the date to be used in the calculation. This example returns 4, which is Wednesday.

The DATEPART function can be used with any of the valid interval values. These interval values are: Year ("yyyy" or "yy"), Quarter ("q"), Month ("m" or "mm"), Day of Year ("y"), Day ("d" or "dd"), Week ("ww"), Hour ("h"), Minute ("n"), and Second ("s").

The DATEPART function is a useful date/time function that can be used to extract a portion of a date/time value.

- The DATEPART function can be used to extract the part of a date, such as year, month, or day.
- The DATEPART function is a date/time function.

The DATEPART function takes four arguments and returns a variant. It can be used to determine the date of a specific interval.

The arguments for the DATEPART function are interval, date, firstdayofweek, and firstdayofyear.

Yes, both the firstdayofweek and firstdayofyear arguments are optional.

The firstdayofweek argument determines the first day of the week.

Yes, the DATEPART function can return the wrong week number because the last Monday in some calendar years is not week 1 instead of week 53.

Drop CSV