翻译或纠错本页面
- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Date Aggregation Operators
Date Aggregation Operators¶
注解
For details on specific operator, including syntax and examples, click on the specific operator to go to its reference page.
Name | Description |
---|---|
$dayOfYear | Returns the day of the year for a date as a number between 1 and 366 (leap year). |
$dayOfMonth | Returns the day of the month for a date as a number between 1 and 31. |
$dayOfWeek | Returns the day of the week for a date as a number between 1 (Sunday) and 7 (Saturday). |
$year | Returns the year for a date as a number (e.g. 2014). |
$month | Returns the month for a date as a number between 1 (January) and 12 (December). |
$week | Returns the week number for a date as a number between 0 (the partial week that precedes the first Sunday of the year) and 53 (leap year). |
$hour | Returns the hour for a date as a number between 0 and 23. |
$minute | Returns the minute for a date as a number between 0 and 59. |
$second | Returns the seconds for a date as a number between 0 and 60 (leap seconds). |
$millisecond | Returns the milliseconds of a date as a number between 0 and 999. |
$dateToString | Returns the date as a formatted string. |
$isoDayOfWeek | Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday) to 7 (for Sunday). |
$isoWeek | Returns the week number in ISO 8601 format, ranging from 1 to 53. Week numbers start at 1 with the week (Monday through Sunday) that contains the year’s first Thursday. |
$isoWeekYear | Returns the year number in ISO 8601 format. The year starts with the Monday of week 1 (ISO 8601) and ends with the Sunday of the last week (ISO 8601). |