On this page本页内容
$week
¶Returns the week of the year for a date as a number between 0 and 53.以0到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. 一年中第一个星期日之前的几天是在第0周。This behavior is the same as the “此行为与%U
” operator to the strftime
standard library function.strftime
标准库函数的“%U
”运算符相同。
The $week
expression has the following operator expression syntax:$week
表达式具有以下运算符表达式语法:
Changed in version 3.6.在版本3.6中更改。
The argument must be a valid expression that resolves to one of the following:参数必须是解析为以下之一的有效表达式:
New in version 3.6.版本3.6中的新功能。
date |
The date to which the operator is applied. <dateExpression> must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. | ||||||
timezone |
|
Result | |
---|---|
0 | |
1 | |
33 | |
44 | |
43 | |
error | |
error | |
error |
Note
$week
cannot take a string as an argument.不能将字符串作为参数。