- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Date Aggregation Operators >
- $week (aggregation)
$week (aggregation)¶
On this page
Definition¶
-
$week
¶ Returns the week of the year for a date as a number between 0 and 53.
Weeks begin on Sundays, and week 1 begins with the first Sunday of the year. Days preceding the first Sunday of the year are in week 0. This behavior is the same as the “
%U
” operator to thestrftime
standard library function.The
$week
expression has the following syntax:The argument can be any valid expression as long as it resolves to a date. For more information on expressions, see Expressions.