Details
-
Task
-
Status: Closed
-
Major - P3
-
Resolution: Done
-
None
-
None
-
Minor Change
-
Query 2017-06-19, Query 2017-07-10
Description
The new functionality adds the timezone argument to the date extraction functions ($year, $month, $day, $hour, $minute, $second, $millisecond, $isoYear, $isoWeekYear, and $isoDayOfWeek). Currently the operators only take a single value:
{ "$month" : ISODateValue }
|
Because it is not possible to add another argument to this, the syntax has
been extended to:
{ "$month" : { "date" : ISODateValue } }
|
And then with the time zone argument added, it becomes:
{ "$month" : {
|
"date" : ISODateValue,
|
"timezone": timeZoneIdentifier
|
} }
|
For example:
{ $hour: {
|
date: ISODate("1978-12-22T08:15:00Z"),
|
timezone: "Europe/Amsterdam"
|
} }
|
Would return 09 (One hour later than UTC).
The "timezone" argument is optional, and must evaluate to specify an Olson Timezone Identifier such as "Europe/London" or "America/New_York", or, a UTC offset string in the forms: "+03", "-0530", and "+04:45". If you specify a timezone argument it means that the dateString that you provided will be interpreted as it was in that time zone.
Attachments
Issue Links
- is depended on by
-
SERVER-465 date matcher helpers
-
- Closed
-
- is documented by
-
DOCS-10525 Docs for SERVER-28611: Add the tzExpression argument to the date extraction functions
-
- Closed
-