Last updated: August 25, 2026.
The Access DatePart function returns a selected component of a date, such as its year, month, quarter, or week number.
Syntax
DatePart(interval, date [, firstdayofweek [, firstweekofyear]])| Interval | Returns | Example |
|---|---|---|
yyyy | Year | DatePart("yyyy", #8/25/2026#) → 2026 |
q | Quarter | 3 |
m | Month | 8 |
d | Day | 25 |
ww | Week of year | Depends on week settings |
Query example
OrderYear: DatePart("yyyy", [OrderDate])
OrderQuarter: DatePart("q", [OrderDate])
ISOStyleWeek: DatePart("ww", [OrderDate], vbMonday, vbFirstFourDays)Week results depend on firstdayofweek and firstweekofyear. Specify both arguments when a report must follow a defined calendar rather than the user’s system defaults. Microsoft’s Access date-function guide compares the available choices.